Easiest way to implode() a two-dimensional array?

后端 未结 7 1687
眼角桃花
眼角桃花 2020-12-16 11:26

I\'m new to PHP, and don\'t have quite the grip on how it works. If I have a two dimensional array as such (returned by a database):

array(3) {   
    [0]=&         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 12:01

    If one simply wants to implode a single array "column" as in this case, then the simplest thing to do is:

    implode(",", array_column($array,"tag_id")); 
    

提交回复
热议问题