Test for the existence of a null property

    Date: 08/08/06 (PHP Community)    Keywords: no keywords

    Hi there!

    I'm looking for a method to test, whether an object has a certain property. Consider the following snippet:

    class A { var $aaa; }
    $var = new A;


    (Assuming that the structure of class A is unknown) I need a way to check whether $var->aaa exists (test positive), and whether $var->xxx exists (test negative). I tried boolean tests, isset(), is_null(), but they can't tell the difference. I guess I could convert the object to an array and test its indices, but that wouldn't be practical for large objects with many fields.

    Any other ideas? Thanks in advance.

    Source: http://community.livejournal.com/php/480431.html

« Secure file failsafe header || php form mail script »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home