Programming Tips - Is there a robust way to check a string for being empty?

Date: 2016nov15 Language: php Q. Is there a robust way to check a string for being empty? A. These functions handle undefined, null, zero length and ignore leading and trailing space
function isSpace($a) { if ($a == null) return true; if ($a == '') return true; return preg_match('/^\s*$/', $a); } function hasContent($a) { return ! isSpace($a); }