Created
March 29, 2016 15:24
-
-
Save zeraphie/43c5a24678dcb9bdad61 to your computer and use it in GitHub Desktop.
Make any text 'excerpty'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Make any text 'excerpty' | |
function excerptify($text, $length = 140){ | |
return trim(substr($text, 0, strpos($text, ' ', $length))) . '...'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment