title: PHP if date is older than X days
body: <p>I have some problems with dates. I need make if like ---></p>
  
  <p><em>if your activity is less than 1 day do somethink</em></p>
  
  <p><em>else if your activity is more than 1 day and less than 3 do moething else</em></p>
  
  <p><em>else if your activity is more than 3 do moething else</em></p>
  
  <p>I need this in PHP. My actual code is:</p>
  
  <pre><code>if (strtotime(strtotime($last_log)) &lt; strtotime('-1 day') ) {
      $prom .= "" . json_encode('last_activity') . ": " . json_encode("inactive less than 1 day") . ",";
  } else if (strtotime($last_log) &gt; strtotime('-1 day') &amp;&amp; strtotime($last_log) &lt; strtotime('-3 day')) {
      $prom .= "" . json_encode('last_activity') . ": " . json_encode("inactive more than 1 day and less than 3 days") . ",";
  } else if (strtotime($last_log) &gt; strtotime('-3 day')) {
      $prom .= "" . json_encode('last_activity') . ": " . json_encode("inactive more than 3") . ",";
  }
  </code></pre>
  
  <p>I think I really don't understand date calculations.</p>