note 53844 added to function.trim
| From: | php-general at lists dot php dot net | Date: | Wed, 15 Jun 2005 04:54:12 +0000 |
| Subject: | note 53844 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90439@lists.php.net to get a copy of this message | ||
here's a heads up folks.
in the event that you want to check the result of a trim for being empty the following code fails::
$emptyvar = " ";
if ( empty(trim($emptyvar)) )
{
echo "It was empty";
}
this code works as expected::
$emptyvar = " ";
$check = trim($emptyvar);
if ( empty($check) )
{
echo "It was empty";
}
----
Manual Page -- http://www.php.net/manual/en/function.trim.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53844
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53844&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53844&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53844&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53844&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53844&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53844&report=yes
Search -- http://master.php.net/manage/user-notes.php