I know this is an old thread, but hopefully this will help someone. In my experience, this is the best way to recursively cast an object to an array.
$array = json_decode(json_encode($object), true);
I know this is an old thread, but hopefully this will help someone. In my experience, this is the best way to recursively cast an object to an array.
$array = json_decode(json_encode($object), true);