note 99588 modified in function.trim by danbrown
| From: | danbrown@php.net | Date: | Wed, 25 Aug 2010 14:01:15 +0000 |
| Subject: | note 99588 modified in function.trim by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172046@lists.php.net to get a copy of this message | ||
Please consider the following:
<?php
$a = '0';
if (trim($a)) {
echo 'Never ever ...';
} else {
echo 'YES, "(bool)trim(\'0\')" is FALSE';
}
?>
So never forget to use:
if (trim($a) != '') ...
This cast costs me some time...
--was--
Please consider the following:
$a = '0';
if (trim($a)) {
echo 'Never ever ...';
} else {
echo 'YES, "(bool)trim(\'0\')" is FALSE';
}
So never forget to use:
if (trim($a) != '') ...
This cast costs me some time...
http://php.net/manual/en/function.trim.php