Multidimensional Array to String

后端 未结 7 597
挽巷
挽巷 2020-12-03 11:59

I am trying to convert a multidimensional array into a string with a particular format.

function convert_multi_array($array) {
    foreach($array as $value)          


        
相关标签:
7条回答
  • 2020-12-03 12:30

    Saving the imploded inner arrays to an array. Then imploding those.

    (written in the spirit of your original implementation)

    function convert_multi_array($arrays)
    {
        $imploded = array();
        foreach($arrays as $array) {
            $imploded[] = implode('~', $array);
        }
        return implode("&", $imploded);
    }
    
    0 讨论(0)
提交回复
热议问题