note 56029 deleted from function.is-null by mazzanet
| From: | mazzanet@php.net | Date: | Sun, 21 Aug 2005 10:13:17 +0000 |
| Subject: | note 56029 deleted from function.is-null by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93982@lists.php.net to get a copy of this message | ||
Note Submitter: thomas AT pixtur _._ de
----
I use is_null() to trigger warning on access of undefined object-members with php5.
Consider this example:
-------------------------------
class Obj {
public $hello=false;
}
$obj = new Obj;
is_null($obj->hallo) # will at least trigger a WARNING before...
$obj->hallo="bla"; # ...adding a new project-member
-----------------------------------
I really have a hard time to check, if an variable has been defined. The problem is, that isset()
return false, if the values is defined but converted to zero.
An is_defined()-function would help, but I could not find one.
I know, that I could overwrite __set() but this raises other php5 issues a little but to complex to
explain here.
If anyone has a better way of testing on definition, PLEASE write me an mail.
tom