Re: isset($a->b) even if $a->b = null
| From: | Borokov Smith | Date: | Fri, 17 Aug 2007 11:48:07 +0000 |
| Subject: | Re: isset($a->b) even if $a->b = null | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260951@lists.php.net to get a copy of this message | ||
Olav Mørkrid schreef:
how do i test if a property of a stdclass object is set, even if its value is null, similar to how array_key_exists() works for arrays. the following method fails: $a->b = null; if(isset($a->b))echo "yes";and property_exists() seems only to work for defined objects. hope someone can help. thanks! if (isset($a -> b) && $a -> b != null) { echo "yes"; }