dimanche 23 juillet 2017

Php, get properties of object, except unset-ted

class Example
{
    private $fa, $fb;

    public function u()
    {
        unset($this->fb);
    }
}

$example = new Example();
$example->u();
foreach((new \ReflectionObject($example))->getProperties(\ReflectionProperty::IS_PRIVATE) as $v)
{
    echo '<pre>';
    var_dump($v);
    echo '</pre>';
}

it will print even fb although its been unsetted.





Aucun commentaire:

Enregistrer un commentaire