How do I convert an object to an array?

后端 未结 11 1392
别那么骄傲
别那么骄傲 2020-11-22 10:36
response->docs);
?>

Outputs the following:

    Array 
(
    [0] => Object 
            (         


        
11条回答
  •  醉梦人生
    2020-11-22 11:01

    I had the same problem and I solved it with get_object_vars mentioned above.

    Furthermore, I had to convert my object with json_decode and I had to iterate the array with the oldschool "for" loop (rather then for-each).

提交回复
热议问题