title: PHP combine 2 datetime arrays
body: <p><strong>&gt; Hi I have been trying to work around this problem from almost 2 days now,
  Now i have 2 arrays of which i'd like to group them  into one array :</strong></p>
  <pre><code>$arrayA= Array
      (
          [0] =&gt; 08:00am
          [1] =&gt; 10:00am
          [2] =&gt; 12:00pm
          [3] =&gt; 02:00pm
          [4] =&gt; 04:00pm
          [5] =&gt; 06:00pm
          [6] =&gt; 08:00pm
          [7] =&gt; 10:00pm
      )
      
  
  &amp;
  
  
  
  $arrayB= Array
      (
          [0] =&gt; 09:00am
          [1] =&gt; 11:00am
          [2] =&gt; 01:00pm
          [3] =&gt; 03:00pm
          [4] =&gt; 05:00pm
          [5] =&gt; 07:00pm
          [6] =&gt; 09:00pm
      )
  </code></pre>
  <blockquote>
  <p>i tried:</p>
  </blockquote>
  <pre><code>  foreach ($arrayA as $keeyy=&gt;$val)
      {        $arrC[] = $val.&quot; &quot;.&quot;to&quot;.&quot; &quot;.$$arrayB[$keeyy];
          }
  </code></pre>
  <blockquote>
  <p>but my result was:</p>
  </blockquote>
    <br />
  <b>Notice</b>:  Undefined offset: 7 in <b>C:\Users\user\Desktop\xammp\htdocs\Ea....on line 104</b><br />
  <pre><code>$arrC=      Array
      (
          [0] =&gt; 08:00am to 09:00am
          [1] =&gt; 10:00am to 11:00am
          [2] =&gt; 12:00pm to 01:00pm
          [3] =&gt; 02:00pm to 03:00pm
          [4] =&gt; 04:00pm to 05:00pm
          [5] =&gt; 06:00pm to 07:00pm
          [6] =&gt; 08:00pm to 09:00pm
          [7] =&gt; 10:00pm to 
      )
  </code></pre>
  <blockquote>
  <p>What i want to achieve is:</p>
  </blockquote>
  <pre><code>Array C
  (
      [0] =&gt; 8:00am To 09:00am  
      [1] =&gt;09:00am To 10:00am
      [2] =&gt;10:00am To 11:00am
      [3] =&gt; 11:00am To 12:00pm
      [4] =&gt; 12:00pm To 1:00pm
      [5] =&gt; 1:00pm To 2:00pm
      [6] =&gt; 2:00pm To 3:00pm
      [7] =&gt; 3:00pm To 4:00pm
      [8] =&gt; 4:00pm To 5:00pm
      [9] =&gt; 5:00pm To 6:00pm
      [10] =&gt; 6:00pm To 7:00pm
      [11] =&gt; 7:00pm To 8:00pm
      [12] =&gt; 8:00pm To 9:00pm
      [13] =&gt; 9:00pm To 10:00pm
  )
  </code></pre>
  <blockquote>
  <p>Any help will be very appreaciated.Thank you!!</p>
  </blockquote>