1// The manual specifies the second argument of json_decode as:
2// assoc
3// When TRUE, returned objects will be converted into associative arrays.
4
5
6$array = json_decode(json_encode($booking), true);
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}