title: push an element to each array in a multidimentional array in php?
body: <p>Here's my array</p>
  
  <pre><code>$myArr  = array(array('one', 'two'), array('one', 'two'));
  </code></pre>
  
  <p>I would like add an element to every array inside the <strong>$myArr</strong>. I dont wanna loop over each array inside and add that element. Is there any quicker way to achieve this using <strong>array_map</strong> or <strong>array_walk</strong>.. preferably <strong>with one line of code</strong>?   </p>
  
  <p>Result array should be like</p>
  
  <pre><code>$myArr  = array(array('one', 'two','three'), array('one', 'two','three'));
  </code></pre>
  
  <p>Thanks a bunch</p>
  
  <p>Got it, Kudos to <a href="https://stackoverflow.com/users/39992/strager">@strager</a> </p>
  
  <pre><code>$myvar = 'Three';
  
  $myArr = array_map(function ($subarray) {  global $myvar; $subarray[] = $myvar;   return $subarray;}, $myArr);
  </code></pre>