title: shortening this snippet of php and jquery, can it be done?
body: <p>so I have a URL containing an array. When the page refreshes, I want to check if certain values are still present in the URL and if not, delete any cookies that may have been associated with it.</p>
  
  <p>The code is as follows:</p>
  
  <pre><code>&lt;?php if((isset($_GET['categories']) &amp;&amp; !in_array(2, $_GET['categories']))) { ?&gt;
      if($.cookie('hf')=='1'){$.removeCookie('hf');}
  &lt;?php } if((isset($_GET['categories']) &amp;&amp; !in_array(7, $_GET['categories']))) { ?&gt;
      if($.cookie('hb')=='1'){$.removeCookie('hb');}
  &lt;?php } if((isset($_GET['categories']) &amp;&amp; !in_array(5, $_GET['categories']))) { ?&gt;
      if($.cookie('hp')=='1'){$.removeCookie('hp');}
  &lt;?php } if((isset($_GET['categories']) &amp;&amp; !in_array(4, $_GET['categories']))) { ?&gt;
      if($.cookie('hw')=='1'){$.removeCookie('hw');}
  &lt;?php } ?&gt;
  </code></pre>
  
  <p>This works perfectly, but is it the best way to go about checking the array and clearing any eventual cookies?</p>
  
  <p>Any help or confirmation is appreciated. Thanks.</p>