title: How can I loop through two arrays at once?
body: <p>I am trying to arrange two arrays together and the results keep coming out incorrect. I'll show you my code, the results I'm getting and the results I'm looking for.</p>
  
  <p>I guess I'm just doing it wrong but not sure how else to do it.</p>
  
  <p>My code:</p>
  
  <pre><code>$data1 = [
      'a: 1',
      'a: 2',
      'a: 3',
      'a: 4',
      'a: 5'
  ];
  
  $data2 = [
      'b: 1',
      'b: 2',
      'b: 3',
      'b: 4',
      'b: 5'
  ];
  
  
  foreach($data1 as $item1)
  {
      foreach($data2 as $item2)
      {
          echo $item1 . '&lt;br/&gt;';
          echo $item2 . '&lt;br/&gt;';
          echo '&lt;br/&gt;&lt;br/&gt;';
      }
  }
  </code></pre>
  
  <p>The Results: (shortened to save space)</p>
  
  <pre><code>a: 1
  b: 1
  
  a: 1
  b: 2
  
  a: 1
  b: 3
  
  a: 1
  b: 4
  
  a: 1
  b: 5
  </code></pre>
  
  <p>The results I'm looking for is the following:</p>
  
  <pre><code>a: 1
  b: 1
  
  a: 2
  b: 2
  
  a: 3
  b: 3
  
  a: 4
  b: 4
  
  a: 5
  b: 5
  </code></pre>