title: $var is valid unix timestamp
body: <p>I need a function to validate if the content of a variable is a valid unix timestamp.</p>
  
  <p>I've checked this thread: <a href="https://stackoverflow.com/questions/2524680/check-whether-the-string-is-a-unix-timestamp">Check whether the string is a unix timestamp</a> but the problem is that the function in the most voted answer still can cause some errors, for eg:</p>
  
  <pre><code>function is_timestamp($timestamp)
  {
     return ((string) (int) $timestamp === $timestamp)
     &amp;&amp; ($timestamp &lt;= PHP_INT_MAX)
     &amp;&amp; ($timestamp &gt;= ~PHP_INT_MAX);
  }
  
  // Some tests:
  $timestamp = 1289216307;
  var_dump(is_timestamp($timestamp));
  var_dump(date('Y-m-d', $timestamp));
  
  // result
  bool(false)
  string(10) "2010-11-08" 
  
  $timestamp = '20101108';
  var_dump(is_timestamp($timestamp));
  var_dump(date('Y-m-d', $timestamp));
  
  // result
  bool(true)
  string(10) "1970-08-21" 
  </code></pre>
  
  <p>Here, the first should be <strong>TRUE</strong> and the second should be <strong>FALSE</strong> so, what's the best way to test if a <code>$var</code> is a real valid unix timestamp?</p>