How to convert an array to object in PHP?

前端 未结 30 3332
说谎
说谎 2020-11-22 02:48

How can I convert an array like this to an object?

[128] => Array
    (
        [status] => "Figure A.
 Facebook\'s horizontal scrollbars showing u         


        
30条回答
  •  迷失自我
    2020-11-22 03:23

    The easy way would be

    $object = (object)$array;
    

    But that's not what you want. If you want objects you want to achieve something, but that's missing in this question. Using objects just for the reason of using objects makes no sense.

提交回复
热议问题