I have few functions that sanitize everything in get and post but this one must be bit more specific , I have an array that is producing links like
array(
1 => http://site/something/another/?get_something=1
2 => http://site/something/another2/?get_something=1
)
also have a function that is sanitizing get and post but that function would clear everything from this array values so I am left with
httpsitesomethinganotherget_something1
can someone please help to match EVERYTHING after get_something=
and clear it or replace it with get_something=1 , something like
$clear = preg_match('/^[A-Za-z0-9]+$/', $array[1]);
preg_replace("/get_something=".$clear."/i","",$array[1]);
You should use
parse_urlbut here is a regex implementation, in case you’re curious:Should output (demo [updated]):