Skip to content

Instantly share code, notes, and snippets.

@simonrjones
Last active February 4, 2020 19:37
Show Gist options
  • Save simonrjones/bb1faf4008c4123dd11e01f51e5243a2 to your computer and use it in GitHub Desktop.
Save simonrjones/bb1faf4008c4123dd11e01f51e5243a2 to your computer and use it in GitHub Desktop.
function excerpt(string $string, $length = 50): string
{
$string = explode("\n", wordwrap($string, $length));
return (string) $string[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment