How do I convert an object to an array?

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

Outputs the following:

    Array 
(
    [0] => Object 
            (         


        
11条回答
  •  春和景丽
    2020-11-22 11:06

    You should look at get_object_vars , as your properties are declared private you should call this inside the class and return its results.

    Be careful, for primitive data types like strings it will work great, but I don't know how it behaves with nested objects.

    in your case you have to do something like;

    response->docs));
    ?>
    

提交回复
热议问题