title: PHP foreach with Nested Array?
body: <p>I have a nested array in which I want to display a subset of results. For example, on the array below I want to loop through all the values in nested array[1].</p>
  
  <pre>
  Array
  (
    [0] => Array
      (
        [0] => one
        [1] => Array
          (
            [0] => 1
            [1] => 2
            [2] => 3
          )
      )
  
    [1] => Array
      (
        [0] => two
        [1] => Array
          (
            [0] => 4
            [1] => 5
            [2] => 6
          )
      )
  
    [2] => Array
      (
        [0] => three
        [1] => Array
          (
            [0] => 7
            [1] => 8
            [2] => 9
          )
      )
  )
  </pre>
  
  <p>I was trying to use the foreach function but I cannot seem to get this to work. This was my original syntax (though I realise it is wrong). </p>
  
  <pre>
  $tmpArray = array(array("one",array(1,2,3)),array("two",array(4,5,6)),array("three",array(7,8,9)));
  
  foreach ($tmpArray[1] as $value) {
    echo $value;
  }
  </pre>
  
  <p>I was trying to avoid a variable compare on whether the key is the same as the key I want to search, i.e.</p>
  
  <pre>
  foreach ($tmpArray as $key => $value) {
    if ($key == 1) {
      echo $value;
    }
  }
  </pre>
  
  <p>Any ideas?</p>