CodeIgniter / Json / PHPPHP – Convert stdClass object to array November 25, 2017 Chandan SharmaComment on PHP – Convert stdClass object to arrayThe easiest way is to JSON-encode your object and then decode it back to an array: $array = json_decode(json_encode($object), True); you can traverse the object manually, too: foreach ($object as $value) $array[] = $value->post_id;Share this:FacebookX