note 68927 deleted from function.isset by sobak
| From: | sobak@php.net | Date: | Sat, 10 Dec 2016 09:53:42 +0000 |
| Subject: | note 68927 deleted from function.isset by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208416@lists.php.net to get a copy of this message | ||
Note Submitter: ludie-at-vibage-punkt-kom
----
If you don't want to bother checking every single var with isset or empty, use this function on
every var you use:
<?php
function chk( & $var )
{
if ( !isset($var) )
{
return NULL;
}
else
{
return $var;
}
}
?>
It takes ANYTHING as argument, and returns the exact same thing, but without Notice if the var
doesn't actually exist