Re: isset($a->b) even if $a->b = null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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"; }

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux