Image

Imageswitchstatement wrote in Imagephp

truncating search results

does anyone have any ideas on using the substr() (or some similar) function, but avoiding fragmenting words? if you do:

$string = "jonathan's craving peanutbutter sandwiches";
$string = substr($string, 0, 20);


you get $string == "jonathan's craving pe"

what i'd like to end up with is just "jonathan's craving"