How To Convert Object To An Array in PHP

1. Typecasting Object to Array PHP

$array = (array) $object;

2. Using the JSON Decode and Encode Method

json_decode(json_encode($object), true);