note 91182 modified in function.empty by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 May 2009 22:48:07 +0000 |
| Subject: | note 91182 modified in function.empty by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156130@lists.php.net to get a copy of this message | ||
in cases when "0" is not intended to be empty, here is a simple function to safely test
for an empty string (or mixed variable):
<?php
function _empty($string){
$string = trim($string);
if(!is_numeric($string)) return empty($string);
return FALSE;
}
?>
--was--
in cases when "0" is not intended to be empty, here is a simple function to safely test
for an empty string (or mixed variable):
function _empty($string){
$string = trim($string);
if(!is_numeric($string)) return empty($string);
return FALSE;
}
http://php.net/manual/en/function.empty.php