fork download
  1. <?php
  2. class Person {
  3.  
  4. public $id = 123;
  5. public $firstName = "John";
  6. public $lastName = "Something";
  7. public $address;
  8. public $city;
  9. public $zipCode;
  10. // etc.
  11.  
  12. }
  13.  
  14. $person = new Person;
  15. var_dump( (array)$person);
  16. ?>
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
array(6) {
  ["id"]=>
  int(123)
  ["firstName"]=>
  string(4) "John"
  ["lastName"]=>
  string(9) "Something"
  ["address"]=>
  NULL
  ["city"]=>
  NULL
  ["zipCode"]=>
  NULL
}