title: PHP wrap array elements in separate arrays
body: <p>I have the following array:</p>
  
  <pre><code>$arr = [
      "elem-1" =&gt; [ "title" =&gt; "1", "desc" = &gt; "" ],
      "elem-2" =&gt; [ "title" =&gt; "2", "desc" = &gt; "" ],
      "elem-3" =&gt; [ "title" =&gt; "3", "desc" = &gt; "" ],
      "elem-4" =&gt; [ "title" =&gt; "4", "desc" = &gt; "" ],
  ]
  </code></pre>
  
  <p>First I need to change the value from <code>[ "title" =&gt; "1", "desc" = &gt; "" ]</code> to <code>1</code> (title's value).</p>
  
  <p>I did this using <code>array_walk</code>:</p>
  
  <pre><code>array_walk($arr, function(&amp;$value, $key) {
      $value = $value["title"];
  });
  </code></pre>
  
  <p>This will replace my value correctly. Our current array now is:</p>
  
  <pre><code>$arr = [
      "elem-1" =&gt; "1",
      "elem-2" =&gt; "2",
      "elem-3" =&gt; "3",
      "elem-4" =&gt; "4",
  ]
  </code></pre>
  
  <p>Now, I need to transform each element of this array into its own subarray. I have no idea on how to do this without a <code>for</code> loop. This is the desired result:</p>
  
  <pre><code>$arr = [
      [ "elem-1" =&gt; "1" ],
      [ "elem-2" =&gt; "2" ],
      [ "elem-3" =&gt; "3" ],
      [ "elem-4" =&gt; "4" ],
  ]
  </code></pre>