note 89737 deleted from function.error-reporting by thiago
| From: | thiago@php.net | Date: | Fri, 20 Mar 2009 20:01:24 +0000 |
| Subject: | note 89737 deleted from function.error-reporting by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152229@lists.php.net to get a copy of this message | ||
Note Submitter: misplacedme at g-mail dot com
----
Just something to make things easier.
E_NOTICE will warn you when you try to use un-initialized variables.
If you pass the variable by reference to a function, you can check for it's existence as well
as anything else you need.
<?php
function testNotice(&$var) {
return isset($var) && !empty($var);
}
$foo= 'Line';
var_dump(testNotice($foo)); //bool(true);
var_dump(testNotice($bar)); //bool(false)
?>