You need to check the $_GET pattern for the presence of a key. The keys that are of interest are of the form $_GET['purpose0'], $_GET['purpose1'], $_GET['purpose...N'] . I did not find a suitable function or method to search for the purpose key with any digit after.

  • make an array of the keys of the $ _GET array and check with the regulars - splash58

2 answers 2

 $new = preg_grep("/^purpose\d+$/", array_keys($array)); 
     $pattern = "/^purpose\d+$/"; foreach ($_GET as $key => $value) { $result = preg_match($pattern, $key); if($result) { echo "Совпадение\n"; } }