title: PHP Matching number of occurrences
body: <p>I have this PHP string :</p>
  
  <pre><code>$range = "['2018-03-17','2018-03-19','2018-03-18','2018-03-18']";
  </code></pre>
  
  <p>I'm wanting to loop through the entire string, and do something like..</p>
  
  <pre><code>if day == "Saturday" || day == "Sunday" and only one occurrence of this in string then { // Do something } else { // Do something else }
  </code></pre>
  
  <p>I've explored preg_match_all with a regex [0-9]{4}-[0-9]{2}-[0-9]{2} but I can't get my head around it, any help would be really appreciated.</p>