title: Convert array keys to a string in PHP
body: <p>Example Array:</p>
  
  <pre><code>$array = array([key1] =&gt; 
                  array([key11] =&gt; 
                       array([key111] =&gt; 'value111', 
                             [key112] =&gt; 'value112', 
                             [key113] =&gt; 'value113',
                             [key114] =&gt; array(A,B,C,D), 
                            ),
                   ),
             );
  </code></pre>
  
  <p>I need an output as below array:</p>
  
  <pre><code>array([key1/key11/key111] =&gt; 'value111',
        [key1/key11/key112] =&gt; 'value112', 
        [key1/key11/key113] =&gt; 'value113',
        [key1/key11/key114] =&gt; 'A,B,C,D' );
  </code></pre>
  
  <p>and i have tried using this function,</p>
  
  <pre><code>function listArrayRecursive($someArray, &amp;$outputArray, $separator = "/") {
      $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($someArray), RecursiveIteratorIterator::SELF_FIRST);
      foreach ($iterator as $k =&gt; $v) {
  
          if (!$iterator-&gt;hasChildren()) {
              for ($p = array(), $i = 0, $z = $iterator-&gt;getDepth(); $i &lt;= $z; $i++) {
                  $p[] = $iterator-&gt;getSubIterator($i)-&gt;key();
              }
              $path = implode($separator, $p);
              $outputArray[] = $path;
          }
      }
  }
  
  $outputArray = array();
  listArrayRecursive($array, $outputArray);
  </code></pre>
  
  <p>I cant able to find how to achieve this by using the above function for "key1/key11/key114" getting value as i expected. Please help me on this.</p>