Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

Using the get_class_vars Function

The get_class_vars() function will return an associative array containing all properties of a class that are available in the current scope. demo.php <?php include_once("class1.php"); $properties = get_class_vars("class1"); foreach($properties as $k => $v){ echo "<h3>$k = $v</h3>"; } ?> class1.php <?php class class1 { public $color1 = "blue"; private $color2 = "white"; public $color3 = "silver"; } ?>
thumb

PHP Videos

Object Oriented Programming

Class File Creation Tutorial Learn PHP OOPClass Properties and Methods Object Oriented ProgrammingConvert MySQL Timestamp to Ago Time Format OOP TutorialUsing the property_exists FunctionUsing the method_exists FunctionUsing the get_parent_class functionUsing the get_object_vars FunctionUsing the get_declared_classes FunctionUsing the get_class FunctionUsing the get_class_vars FunctionUsing the get_class_methods FunctionUsing the class_exists FunctionPassword Strength Check Script Class OOP TutorialExtend Class Object Oriented Programming OOP