title: How to get closest date compared to an array of dates in PHP
body: <p><a href="https://stackoverflow.com/questions/11012891/how-to-get-most-recent-date-from-an-array-of-dates">This post</a> almost answered this question for me, but I have a specific need and didn't find what I sought there. This lies right outside my experience; couldn't quite wrap my head around it, so all I really need is a point in the right direction.</p>
  
  <p>Let's say I have an array as follows:</p>
  
  <pre><code>array(5) { 
      [0]=&gt; "2013-02-18 05:14:54" 
      [1]=&gt; "2013-02-12 01:44:03" 
      [2]=&gt; "2013-02-05 16:25:07" 
      [3]=&gt; "2013-01-29 02:00:15" 
      [4]=&gt; "2013-01-27 18:33:45" 
  }
  </code></pre>
  
  <p>I would like to have a way to provide a date ("2013-02-04 14:11:16", for instance), and have a function determine the closest match to this in the array (which would be "2013-02-05 16:25:07" in this case).</p>
  
  <p>I'd appreciate any tips. Thanks! :)</p>