I am trying to convert a multidimensional array into a string with a particular format.
function convert_multi_array($array) {
foreach($array as $value)
You are overwriting $array, which contains the original array. But in a foreach a copy of $array is being worked on, so you are basically just assigning a new variable.
What you should do is iterate through the child arrays and "convert" them to strings, then implode the result.
function convert_multi_array($array) {
$out = implode("&",array_map(function($a) {return implode("~",$a);},$array));
print_r($out);
}