[ create a new paste ] login | about

Link: http://codepad.org/N80u465H    [ raw code | output | fork ]

PHP, pasted on Mar 3:
<?PHP

class a {

    private $firstVar;  

    public function foo()
    {
      $refclass = new ReflectionClass(new b());
      foreach ($refclass->getProperties() as $property)
      {
        echo $property->name;
        //Access the property of B like this
      }
    }
}

class b extends a{
    public $secondVar;  

}

a::foo();
print_r( get_class_vars( 'b' ) );


Output:
1
2
3
4
secondVarArray
(
    [secondVar] => 
)


Create a new paste based on this one


Comments: