get_object_vars and get_class_vars
get_class_vars
This function will return array which contains all the default and public properties of the class
get_object_vars
This function will return array which contains all the default and public properties of an object.
Example:
class Test{
public $tmp1;
public $tmp2;
public static $tmp3;
public function function1(){
echo “function1″;
}
public function function2(){
echo “function2″;
}
}
$objTest = new Test;
$clVars = get_class_vars(”Test”);
print_r($clVars);
$obVars = get_object_vars($objTest);
print_r($obVars);
1. print_r($clVars) will print following array
Array ( [tmp1] => [tmp2] => [tmp3] => )
2.print_r($obVars);will print following array
Array ( [tmp1] => [tmp2] => ).
tmp3 is static member of the class. So it is not come here.
The above is the basic difference between get_class_vars and get_object_vars
