Converting stdClass object to PHP array
#Converting stdClass object to PHP array The easiest way is to JSON-encode your object and then decode it back to an array: $array = json_decode(json_encode($stdclassobject), True); Or you can also traverse the object using loop, too: foreach ($stdclassobject as $value) $array[] = $value->post_id;