title: if statement with a limit php
body: <p>I made this to check my class schedule to remind me when there is no class. I set it on a cron job to check every hour, but my issue is that when there is no class I keep getting alerts all day and can't stop it unless I disable the cron job. <strong>What I would like to know is how I can limit this to only 5 alerts for the entire day?</strong></p>
  
  <pre><code>$source = file_get_contents($website);
  preg_match('#&lt;classtime&gt;(.*?)&lt;/classtime&gt;#', $source, $match);
  
      if (strlen($match[1])&lt;32) {
          mail('XXXXXXXXXX@txt.att.net', 'REMINDER!', 'No Class');
      }
      else
  
      if (strlen($match[1])&gt;32) {
          mail('XXXXXXXXXX@txt.att.net', 'REMINDER!', 'No Class');
      }
  
      else {
          echo "Check Class Schedule";
      }
  </code></pre>