stripping a query string with php (preg_replace)

Posted by pg on Stack Overflow See other posts from Stack Overflow or by pg
Published on 2010-03-23T00:38:24Z Indexed on 2010/03/23 0:41 UTC
Read the original article Hit count: 328

Filed under:
|
|

http://www.chuckecheese.com/rotator.php?cheese=4&id=1

I want to take out the id, leaving the cheese to stand alone. I tried:

$qs = preg_replace("[^&id=*]" ,'',$_SERVER[QUERY_STRING]);

But that said I was using an improper modifier. I want to remove "$id=" and whatever number comes after it. Are regexp really as hard as they seem for me?

© Stack Overflow or respective owner

Related posts about php

Related posts about preg-replace