get_class_vars() function returns an array of attributes defined in the class specified by class_name. : get_class_vars « Reflection « PHP






get_class_vars() function returns an array of attributes defined in the class specified by class_name.

 
//Its syntax is: array get_class_vars (string class_name)

//Using get_class_vars() to create $attribs


<?
class Vehicle {
     var $model;
     var $current_speed;
}
class Airplane extends Vehicle {
     var $wingspan;
}

$a_class = "Airplane";

$attribs = get_class_vars($a_class);
print_r($attribs);
?>
  
  








Related examples in the same category