note 43412 added to function.empty
| From: | JamieBurns at rn2 dot php dot net | Date: | Sun, 20 Jun 2004 17:40:08 +0000 |
| Subject: | note 43412 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71408@lists.php.net to get a copy of this message | ||
If you find yourself writing lots of code to simply check if variables exist (often from form
submissions), to avoid warnings if error reporting is set to E_ALL then this might be helpful to
you:
<?
error_reporting(E_ALL);
// this will trigger error...
if ($doesntexist != '') echo("foobar");
// this will not trigger error, but is lots of code to read/write!
if (isset($doesntexist) && $doesntexist != '') echo("foobar");
// this will not trigger error, and is much cleaner code!
if (@$doesntexist != '') echo("foobar");
?>
--
Jamie Burns.
www.intuitioneshop.com
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43412
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43412&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43412&report=yes
Search -- http://master.php.net/manage/user-notes.php