convert 2d array to a string using php

前端 未结 5 1405
攒了一身酷
攒了一身酷 2021-01-22 06:39

I have the following array

 01 03 02 15
 05 04 06 10
 07 09 08 11
 12 14 13 16

I want to convert a string like the following:

         


        
5条回答
  •  情书的邮戳
    2021-01-22 07:20

    $input = array (
        array ('01','03','02','15'),
        array ('05','04','06','10'),
        array ('07','09','08','11'),
        array ('12','14','13','16'),
    );
    
    echo implode('|', array_map('implode', $input, array_fill(0, count($input), ',')));
    

提交回复
热议问题