note 43412 deleted from function.empty by nlopess
| From: | nlopess@php.net | Date: | Sun, 20 Jun 2004 18:05:02 +0000 |
| Subject: | note 43412 deleted from function.empty by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71409@lists.php.net to get a copy of this message | ||
Note Submitter: Jamie Burns
----
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