How to recombine two-dimensional arrays
亮
2021-09-30 10:43:02
0
4
1138

$a = array(0=>'',1=>arrray(0=>1,1=>2),2=>'',3=>arrray(0=> ;1,1=>2));

How can I turn this two-dimensional array into the following one-dimensional array:

$a = array(

0= >'',

1=>'1,2',

2=>'',

3=>'1,2',

};

亮

reply all (2)
亮

It has been verified that it works. I have the same idea, but I am stuck. Thank you for the guidance.

    逆旅行人

    First of all, there is a problem with your array. What is arrray? Although I don’t know why I wrote it like this, it’s okay if I just force it outimage.png

    • reply The second foreach is redundant foreach($a as $k=>$v){ if(is_array($v)){ $a[$k] = implode(",",$v); } }
      淡然 author 2021-10-04 14:14:19
    • reply Functions are used less, that’s true
      autoload author 2021-10-08 09:05:00
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!