- property_exists: documentation ( source)
- var_dump: documentation ( source)
<?php
class P {
private $prop2;
public function test_prop($prop) { return property_exists(__CLASS__, $prop); }
}
class Child extends P {
private $prop1;
public function test_prop2($prop) { return property_exists(__CLASS__, $prop); }
}
$child = new Child();
var_dump($child->test_prop('prop1')); //true, as of PHP 5.3.0
var_dump($child->test_prop('prop2'));
var_dump($child->test_prop2('prop1'));
var_dump($child->test_prop2('prop2'));