title: get parent array name after array_walk_recursive function
body: <p>I use the following function to verify if a search word is in the name of files of my folder.</p>
  
  <pre><code>$files2=list_files("documents/minelli");
  
  Class Commentaire_filter{
        static function test_print($item, $key, $value)
        {
            if (preg_match("#".$value."#", $item))
  
            {
             $array =  Array($key=&gt;$item);
            print_r($array);
            ?&gt;
  
            &lt;a href="documents/minelli/&lt;?php echo $item; ?&gt;"&gt;&lt;?php echo $key.' '. $item; ?&gt;&lt;/a&gt;&lt;br /&gt; 
            &lt;?php
  
            }
        }
  }
  
  
  array_walk_recursive($files2, 'Commentaire_filter::test_print',$motrecherche );
  </code></pre>
  
  <p>I obtain a list of files.</p>
  
  <p>I would like add a link to permit users to download the file. </p>
  
  <p>When i'm using the array_walk_recursive function, i can only get the name of file and the key. How can i get the name of parent arrays to made the link ?</p>
  
  <p>Here an extract of my $files:</p>
  
  <p>array (size=5)</p>
  
  <p>'Administratifs' => </p>
  
  <pre><code>array (size=5)
  
    0 =&gt; string 'campagne-sanmarina.jpg' (length=22)
  
    1 =&gt; string 'COSMO Echantillons ETE 2009.xls' (length=31)
  
    2 =&gt; string 'COSMOPARIS Echantillons MARO Hiver 2011 311-411.xls' (length=51)
  
    3 =&gt; string 'cosmoparis-boutique.jpg' (length=23)
  
    4 =&gt; string 'minelli-20-ans.png' (length=18)
  </code></pre>
  
  <p>'Commerce' => </p>
  
  <pre><code>array (size=4)
  
    0 =&gt; string 'a-gagner-cosmoparis.jpg' (length=23)
  
    1 =&gt; string 'CONTROLE 2009.pdf' (length=17)
  
    2 =&gt; string 'cosmoparis-boutique.jpg' (length=23)
  
    3 =&gt; string 'soldes-cosmoparis.jpg' (length=21)
  </code></pre>
  
  <p>'Gestion' => </p>
  
  <pre><code>array (size=1)
  
    'PROCEDURES' =&gt; 
  
      array (size=5)
  
        0 =&gt; string 'cosmoparis-boutique.jpg' (length=23)
  
        1 =&gt; string 'flux-ecommerce-smc.pdf' (length=22)
  
        2 =&gt; string 'Minelli-Lyon.jpg' (length=16)
  
        3 =&gt; string 'sanmarina-magasin-interieur.jpg' (length=31)
  
        4 =&gt; string 'visuel_chaussures_minelli_printemps_ete_2009.jpg' (length=48)
  </code></pre>
  
  <p>'Magasins' => </p>
  
  <pre><code>array (size=2)
  
    0 =&gt; string 'COSMO Echantillons ETE 2009.xls' (length=31)
  
    1 =&gt; string 'san-marina-saint-etienne.jpg' (length=28)
  </code></pre>
  
  <p>'Ressources Humaines' => </p>
  
  <pre><code>array (size=7)
  
    'ACTUALITES PAYE' =&gt; 
  
      array (size=3)
  
        0 =&gt; string 'COSMOPARIS Echantillons MARO Hiver 2011 311-411.xls' (length=51)
  
        1 =&gt; string 'cosmoparis-boutique25.jpg' (length=23)
  
        2 =&gt; string 'minelli-tours.jpg' (length=17)
            ...
  </code></pre>
  
  <p>For 'cosmoparis-boutique25.jpg', i would like to get the parent array name ('Ressources Humaines'=>'ACTUALITES PAYE'). How can i get this information to build a link like 'myfolder/Ressources Humaines/ACTUALITES PAYE/cosmoparis-boutique25.jpg ?</p>
  
  <p>Thank you for your help!</p>