Skip to content

Instantly share code, notes, and snippets.

@zeraphie
Created March 29, 2016 15:24
Show Gist options
  • Save zeraphie/43c5a24678dcb9bdad61 to your computer and use it in GitHub Desktop.
Save zeraphie/43c5a24678dcb9bdad61 to your computer and use it in GitHub Desktop.
Make any text 'excerpty'
<?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