title: is there a PHP function to simulate how apache mod_rewrite works?
body: <p>I'm pretty stuck in here, so what I need is a function or, an idea to create a function, to work pretty the same way as mod_rewrite of Apache.
  It is supposed to have as param a regexp, writtten for mod_rewrite, and the url. Should return an array of parameters extracted from it.</p>
  
  <p>Here's a short example of how it should work: </p>
  
  <pre><code>    function rewrite($regexp, $url){ 
             ....
      }
  
      $params = rewrite('([^/]+)-([^/]+).html', 'Oval-Shape.html');
  
      print_r($params);
  </code></pre>
  
  <p>The code above should print:</p>
  
  <pre><code>   array(1=&gt;Oval, 2=&gt;Shape)
  </code></pre>