1$person = new stdClass();
2$person->firstName = "Taylor";
3$person->age = 32;
4
5//Convert Single-Dimention Object to array
6$personArray = (array) $person;
7
8//Convert Multi-Dimentional Object to Array
9$personArray = objectToArray($person);
10function objectToArray ($object) {
11 if(!is_object($object) && !is_array($object)){
12 return $object;
13 }
14 return array_map('objectToArray', (array) $object);
15}