Snippet of the day: Trim a string (the smart way) with PHP

I reworked the feed reading signature images I made a while back and added something to trim the strings to a decent length without breaking words. So here you go. A one-liner that will trim a string to a decent length, and break it on whitespace:

if (strlen($blog_title) > 35) $blog_title = array_shift(explode("|||", wordwrap($blog_title, 35, "|||"))) . "...";