title: How to calculate difference of two string dates in days using PHP?
body: <p>I have two date variables:</p>
  
  <pre><code>$dnow = "2016-12-1";
  $dafter = "2016-12-11";
  </code></pre>
  
  <p>I want to calculate the difference of this two dates which are in string format so how do I calculate?
  I used </p>
  
  <pre><code>date_diff($object, $object2)
  </code></pre>
  
  <p>but it expecting two date object, and I have dates in <strong>String</strong> format
  , After using <code>date_diff</code> I get following error</p>
  
  <blockquote>
    <p>Message: Object of class DateInterval could not be converted to string.</p>
  </blockquote>