Msg#: 4408603 posted 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.
Msg#: 4408603 posted 12:11 pm on Feb 20, 2012 (gmt 0)
Just encountered this again... an alternative... if you want to check that an array contains only empty values (that is PHP's definition of empty [uk.php.net]) then you could use array_filter() [uk.php.net], omitting the 2nd (callback) argument. The default behaviour is to filter out empty elements. So, this becomes...