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}
1$singleArray = [];
2foreach ($parentArray as $childArray)
3{
4 foreach ($childArray as $value)
5 {
6 $singleArray[] = $value;
7 }
8}
9