Multidimensional Array to String
<p>I am trying to convert a multidimensional array into a string with a particular format.</p>

<pre><code>function convert_multi_array($array) {
    foreach($array as $value) {
        if(count($value) &gt; 1) {
            $array = implode("~", $value);
        }
        $array = implode("&amp;", $value);
    }
    print_r($array);
}
$arr = array(array("blue", "red", "green"), array("one", "three", "twenty"));
convert_multi_array($arr);
</code></pre>

<p>Should Output: <code>blue~red~green&amp;one~three~twenty</code> ... and so on for more sub-arrays.</p>

<p>Let me just say that I have not been able to produce any code that is remotely close to the results I want. After two hours, this is pretty much the best I can get. I don't know why the implodes are acting differently than they usually do for strings or maybe I'm just not looking at this right. Are you able to use implode for arrays values?</p>
