title: PHP loop through two different arrays with the same name
body: <p>I'm quite new to PHP. Anyone knows how to loop through two different arrays with the same name? There's first array <code>$test[$i]</code> that values start with <code>&quot;zX&quot; (zX122, xZ1200, etc.)</code> and second array <code>$test[$i]</code> that values start with <code>&quot;X&quot; (X122, X1200 etc.)</code>. Main thing my function does is to check if some value is in interval <code>zX1/zX9 (X1/X9) - zX1200/zX9200 (X1200/X9200)</code>. And I don't have a clue how to perform a correct double loop like &quot;values that starts with <code>zX OR X</code>&quot;. Any hints would be greatly appreciated.</p>
  <pre><code>$test=array();
  
  for ($i=0; $i&lt;201;$i++){
      $test[$i] = &quot;zX&quot;.strval($i);
      $test[$i] = &quot;X&quot;.strval($i);
  }
  
  $test[201] = &quot;zX1&quot;;
  $test[202] = &quot;zX2&quot;;
  $test[203] = &quot;zX3&quot;;
  $test[204] = &quot;zX4&quot;;
  $test[205] = &quot;zX5&quot;;
  $test[206] = &quot;zX6&quot;;
  $test[207] = &quot;zX7&quot;;
  $test[208] = &quot;zX8&quot;;
  $test[209] = &quot;zX9&quot;;
  $test[211] = &quot;X1&quot;;
  $test[212] = &quot;X2&quot;;
  $test[213] = &quot;X3&quot;;
  $test[214] = &quot;X4&quot;;
  $test[215] = &quot;X5&quot;;
  $test[216] = &quot;X6&quot;;
  $test[217] = &quot;X7&quot;;
  $test[218] = &quot;X8&quot;;
  $test[219] = &quot;X9&quot;;
  </code></pre>