PHP: Turning multidimensional arrays to single dimension arrays

前端 未结 7 672
遇见更好的自我
遇见更好的自我 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:35

    I think i found best solution to this :

    array_walk_recursive($yourOLDmultidimarray, function ($item, $key) {
        //echo "$key holds $item\n";
    $yourNEWarray[]=$item;
    });
    

提交回复
热议问题