The Passionate Craftsman

Ruby, PHP, MySql, Software engineering and more.

Thursday, 26 February 2009

How to get the properties of an object with PHP

How to get the properties of an object:

$ref = new ReflectionClass('User');
$props = $ref->getProperties();
foreach($props as $prop) {
echo $prop->name .'
';
}

In this case the properties of the class User will be printed.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home