I am trying to convert a multidimensional array into a string with a particular format.
function convert_multi_array($array) { foreach($array as $value)
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); }