PHP: Turning multidimensional arrays to single dimension arrays

前端 未结 7 609
遇见更好的自我
遇见更好的自我 2021-01-02 10:53

Basically my app is interacting with a web service that sends back a weird multidimensional array such as:

Array
(
    [0] => Array
        (
                     


        
相关标签:
7条回答
  • 2021-01-02 11:36

    If you use php >= 5.6, you may use array unpacking (it's much faster):

    $result = array_merge(...$array);
    

    See wiki.php.net on unpacking

    0 讨论(0)
提交回复
热议问题