title: Get specific element from each sub array
body: <p>I have a common pattern which Im sure there must be a built-in array function in PHP to handle but just can't see it.</p>
  
  <p>I have multiple arrays such as the following:</p>
  
  <pre><code>$testArray = array (
      'subArray1' =&gt; array(
          'key1' =&gt; "Sub array 1 value 1",
          'key2' =&gt; "Sub array 1 value 1"
      ),
      'subArray2' =&gt; array(
          'key1' =&gt; "Sub array 2 value 1",
          'key2' =&gt; "Sub array 2 value 2"
      )
  );
  </code></pre>
  
  <p>I need to get the <code>key1</code> values from each subArray, of which there can be any number.</p>
  
  <p>I always end up just looping over each array to get the required values, but I'm sure there must be an easier, more efficient way to handle this.</p>
  
  <p>I am currently using the following simple foreach to parse the arrays:</p>
  
  <pre><code>$preparedSubs = array();
  
  foreach($testArray as $subArray) {
      $preparedSubs[] = $subArray['key1'];
  }
  </code></pre>
  
  <p>It's as short as I can make it, but as I said I'm sure there is a PHP construct that would handle this better.</p>