title: Array Map a PHP Multidimensional Array
body: <p>Have a multidimensional array</p>
  
  <pre><code>$template=Array (
   [0] =&gt; Array ( [id] =&gt; 352 [name] =&gt; a ) 
   [1] =&gt; Array ( [id] =&gt; 438 [name] =&gt; b ) 
   [2] =&gt; Array ( [id] =&gt; 351 [name] =&gt; c ) 
                 ) 
  </code></pre>
  
  <p>and an array map function</p>
  
  <pre><code>function myfunction()
  {
  
  return "[selected]=&gt;null";
  }
  print_r(array_map("myfunction",$template));
  </code></pre>
  
  <p>which results in</p>
  
  <pre><code>Array ( 
     [0] =&gt; [selected]=&gt;null 
     [1] =&gt; [selected]=&gt;null 
     [2] =&gt; [selected]=&gt;null
      )
  </code></pre>
  
  <p>how do I map the array to get this result instead</p>
  
  <pre><code>Array (  
          [0] =&gt; Array ( [id] =&gt; 352 [name] =&gt; a [selected] =&gt; null)  
          [1] =&gt; Array ( [id] =&gt; 438 [name] =&gt; b  [selected] =&gt; null)  
          [2] =&gt; Array ( [id] =&gt; 351 [name] =&gt; c  [selected] =&gt; null) 
      )
  </code></pre>