php convert object to an array code example
Example 1: php object to array
//This works best
$array = json_decode(json_encode($object), true);
Example 2: object to array php
$array = (array) $yourObject;
//This works best
$array = json_decode(json_encode($object), true);
$array = (array) $yourObject;