Why is the second array one less then the first?
<p>What is causing the second function to miss the last item of the second array?  </p>

<pre><code>$x = array(
  'Mon Sep 12 12:19:33 +0000 2011',
  'Tue Sep 13 14:19:33 +0000 2011',
  'Wed Sep 14 01:19:33 +0000 2011',
  'Thu Sep 15 07:19:33 +0000 2011',
  'Fri Sep 16 16:19:33 +0000 2011',
  'Fri Sep 16 19:19:33 +0000 2011',
  'Sat Sep 17 15:57:37 +0000 2011',
  'Sun Sep 18 13:01:39 +0000 2011', 
  'id' =&gt; array('a','b')
);

//Create function to turn timestamps into unix timestamps so
function textTimeToUnixTime($x) {
  $z = array();
  for($i = 0; $i &lt; count($x) - 1; $i++) {
    array_push($z, strtotime($x[$i]));
  }
  return $z;
}

function timeDifference($x)  {
  //Get Time Difference of the timestamps
  array_reverse($x);
  $z = array();
  for($i = 0; $i &lt; count($x) - 1; $i++) {
    $a = $x[$i+1] - $x[$i];
    array_push($z, $a);
  }
  return $z;
}
</code></pre>

<p>Output</p>

<pre><code>array(8) {
  [0]=&gt; int(1315829973) 
  [1]=&gt; int(1315923573) 
  [2]=&gt; int(1315963173) 
  [3]=&gt; int(1316071173) 
  [4]=&gt; int(1316189973) 
  [5]=&gt; int(1316200773) 
  [6]=&gt; int(1316275057) 
  [7]=&gt; int(1316350899)
} 

array(7) {
  [0]=&gt; int(93600) 
  [1]=&gt; int(39600) 
  [2]=&gt; int(108000) 
  [3]=&gt; int(118800) 
  [4]=&gt; int(10800) 
  [5]=&gt; int(74284) 
  [6]=&gt; int(75842)
} 
</code></pre>
