PHP Split String on Word Break (No Regex or Arrays, Dead Simple)

Need to take a string of text and shorten it down but make sure you split on a word break?

This little snippet might be exactly what you are looking for.

$text=substr($text, 0, strpos($text, ' ', 50));

effectively you are saying give me the position of the first space after character 50 and then chop the string there.

Tags: phpsplitstringwordtipstrpossubstrshortenbreakregex