note 51398 deleted from function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:22:07 +0000 |
| Subject: | note 51398 deleted from function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189636@lists.php.net to get a copy of this message | ||
Note Submitter: manithu
----
An faster (and eleganter) way than using regular expressions to check if a string only contains
whitespaces is to use trim().
Example:
<?php
if (!trim($foobar)) {
echo 'The string $foobar is empty!';
}
?>
I hope this helps somebody.