Method#1: Reformat URL and Use PHP in_array()
Why not reformat your url to something like this: example.php?grab[]=1&grab[]=3&something=... which automatically returns the grab value as an array in PHP?
And then do something like:
if(isset($_GET['grab']) && in_array(4, $_GET['grab'])) {
// do something
}
Method#2: Split String into Array and Use PHP in_array()
If you do not wish to reformat your url, then simply split the string into an array using php's explode function and check if value exists, for example:
if(isset($_GET['grab'])) {
$grab_array = explode(",", $_GET['grab'])
if(in_array(4, $grab_array)) {
// do something
}
}
Method#3: Use Regular Expressions
You could also use regular expressions to check for a match.
explodeyour grab parameter and usein_arrayor usestrposand check for!== false(meaning it's in there)