note 100428 deleted from function.isset by danbrown
| From: | danbrown@php.net | Date: | Fri, 15 Oct 2010 15:01:26 +0000 |
| Subject: | note 100428 deleted from function.isset by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173232@lists.php.net to get a copy of this message | ||
Note Submitter: anthony at zapper dot hodgers dot com
----
If your getting "Notice: Undefined property: stdClass::<VARIABLE> in <FILENAME> on
line <LINENUMBER>"
with the issetOr in http://www.php.net/manual/en/function.isset.php#98420,
I've modified it slightly to get by reference, which solves the issue
/**
* this function results a variable or if variable not set returns default
* @param mixed - variable to check if exists
* @param [optional] mixed - default to set variable to
* @returns mixed - first parameter, if set otherwise default
* @see {http://www.php.net/manual/en/function.isset.php#98420}
*/
function issetOr(&$var, $or = false) {
return (isset($var)) ? $var : $or;
}
ps great function original poster