Mega Code Archive

 
Categories / Php / Statement
 

Iterating Through Object Properties

<?     class Person {             public $FirstName = "B";             public $MiddleName = "T";             public $LastName = "M";             private $Password = "asdfasdf";             public $Age = 29;             public $HomeTown = "Edinburgh";             public $FavouriteColor = "Purple";     }     $bill = new Person( );     foreach($bill as $var => $value) {             echo "$var is $value\n";     } ?>