How to convert an array to object in PHP?

前端 未结 30 3335
说谎
说谎 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:02

    CakePHP has a recursive Set::map class that basically maps an array into an object. You may need to change what the array looks like in order to make the object look the way you want it.

    http://api.cakephp.org/view_source/set/#line-158

    Worst case, you may be able to get a few ideas from this function.

提交回复
热议问题