title: How to determine if value is a date in PHP
body: <p>I am working with arrays of values in PHP. Some of these values may include a date in various string formats.</p>
  
  <p>I need to convert dates in multiple formats to their numerical equivalent (Unix timestamp). The problem is being able to determine if the string is a date.</p>
  
  <p>Using</p>
  
  <pre><code>if (($timestamp = strtotime($str)) === false)
  </code></pre>
  
  <p>will check for a valid date from a string but how do I determine if the value should even be validated as a date?</p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>$x = {1,2,3,"4","11/12/2009","22/12/2000",true,false};
  
  foreach($x as $value)
  {
  
  if(is_bool($value))
  
  if(is_string($value))
  
  if(is_numeric($value))
  
  if(is_date($value)) ?
  
  ...
  
  }
  </code></pre>
  
  <p>In short, is there an easy way to check if a string value is a date?</p>