penders - 7:05 pm on Jan 19, 2012 (gmt 0)
I would agree, that looks pretty simple and fits your example.
But your example seems to be a special case, since a string containing a space is not strictly 'empty' as far as PHP is concerned. So even if there was a PHP function to perform this action, I would guess it would fail.
Likewise, 'empty' values includes '0' and empty array's which would cause your current test to fail.