title: PHP Delete all files that contain a given string
body: <p>I have a basic cache system setup which saves a file based on the parameters in the url so that if that page gets viewed again it accesses the static file.  eg if my url is</p>
  
  <pre><code>http://www.example.com/female/?id=1
  </code></pre>
  
  <p>I have a file located in a cache folder called id=1.html</p>
  
  <pre><code>female/cache/id=1.html
  </code></pre>
  
  <p>currently this is cached for a specified amount of time however I want it to always use the cached file unless the page is updated.  </p>
  
  <p>So I implemented the below php code.</p>
  
  <pre><code>    &lt;?
          unlink('../' . $gender . '/cache/id=' . $_POST['id'] . '.html');
      ?&gt;
  </code></pre>
  
  <p>this works fine however, some times there are additional parameters in my url.  So currently I have the below files in my cache folder</p>
  
  <pre><code>    female/cache/id=1.html
      female/cache/id=1&amp;type=2.html
      female/cache/id=1&amp;type=3.html
      female/cache/id=1&amp;type=3&amp;extra=4.html
  </code></pre>
  
  <p>But when I save my content only female/cache/id=1.html is removed.</p>
  
  <p>How would I go about removing any file in this folder with the id=1</p>