title: Get path and value of all elements in nested associative array
body: <p>Consider an associative array of arbitrary form and nesting depth, for example:</p>
  
  <pre><code>$someVar = array(
      'name'      =&gt; 'Dotan',
      'age'       =&gt; 35,
      'children'  =&gt; array(
          0 =&gt; array(
              'name'  =&gt; 'Meirav',
              'age'   =&gt; 6,
          ),
          1 =&gt; array(
              'name'  =&gt; 'Maayan',
              'age'   =&gt; 4,
          )
      ),
      'dogs' =&gt; array('Gili', 'Gipsy')
  );
  </code></pre>
  
  <p>I would like to convert this to an associative array of paths and values:</p>
  
  <pre><code>$someVar = array(
      'name'            =&gt; 'Dotan',
      'age'             =&gt; 35,
      'children/0/name' =&gt; 'Meirav',
      'children/0/age'  =&gt; 6,
      'children/1/name' =&gt; 'Maayan',
      'children/1/age'  =&gt; 4,
      'dogs/0'          =&gt; 'Gili',
      'dogs/1'          =&gt; 'Gipsy'
  );
  </code></pre>
  
  <p>I began writing a recursive function which for array elements would recurse and for non-array elements (int, floats, bools, and strings) return an array <code>$return['path']</code> and <code>$return['value']</code>. This got sloppy quick! <strong>Is there a better way to do this in PHP?</strong> I would assume that callables and objects would not be passed in the array, though any solution which deals with that possibility would be best. Also, I am assuming that the input array would not have the <code>/</code> character in an element name, but accounting for that might be prudent! <strong>Note that the input array could be nested as deep as 8 or more levels deep!</strong></p>