title: How to find missing values in a sequence with PHP?
body: <p>Suppose you have an array "value => timestamp". The values are increasing with the time but they can be reset at any moment.</p>
  
  <p>For example :</p>
  
  <pre><code>$array = array(
  1 =&gt; 6000,
  2 =&gt; 7000,
  3 =&gt; 8000,
  7 =&gt; 9000,
  8 =&gt; 10000,
  9 =&gt; 11000,
  55 =&gt; 1000,
  56 =&gt; 2000,
  57 =&gt; 3000,
  59 =&gt; 4000,
  60 =&gt; 5000,
  );
  </code></pre>
  
  <p>I would like to retrieve all the missing values from this array. </p>
  
  <p>This example would return :</p>
  
  <pre><code>array(4,5,6,58)
  </code></pre>
  
  <p>I don't want all the values between 9 and 55 because 9 is newer than the other higher values.</p>
  
  <p>In real condition the script will deal with thousands of values so it need to be efficient.</p>
  
  <p>Thanks for your help!</p>
  
  <hr>
  
  <p>UPDATE :
  The initial array can be ordered by timestamps if it is easier for the algorithm.</p>
  
  <hr>
  
  <p>UPDATE 2 :
  In my example the values are UNIX timestamps so they would look more like this : 1285242603 but for readability reason I simplified it.</p>