note 52923 modified in function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:22:28 +0000 |
| Subject: | note 52923 modified in function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189637@lists.php.net to get a copy of this message | ||
If you want to check whether something ONLY has whitespaces, use the
following: <?php if
(trim($foobar)=='') { echo 'The string $foobar only
contains whitespace!'; } ?>
--was--
Note that manithu's post on 29-Mar-2005 02:49 for identifying strings that only contain
whitespaces will also identify strings like "0" and " 0 " as being empty. If
you want to check whether something ONLY has whitespaces, use the following:
<?php
if (trim($foobar)=='') {
echo 'The string $foobar only contains whitespace!';
}
?>
http://php.net/manual/en/function.trim.php