获取GET方法变量的名称

I have about 5 variables in GET method. They almost always have different names, encoded mostly. How i can get name (not value) of those variables.

example:

$_GET['orchid'] = red;
$_GET['xyc'] = wrack;

and after that, next time i open the page:

$_GET['rose'] = red;
$_GET['gzuy'] = bottle;

Values are not important for now, in this case I need names of variables: "orchid", "xyc" or in second case "rose" and "gzuy".

array_keys($_GET)

For more informations, see the link bellow:

http://php.net/manual/function.array-keys.php

   foreach ($_GET as $key=>$value){
    echo $key;

   }
foreach ($_GET as $key => $value) {
    //Line below is optional to get around empty values.
    if (!empty($value))
    echo $key, '  ';
}

The above code will print out all of the set $_GET variables, having file.php?moo will mark moo as set but with a value of nothing. The below snippet will simply return an array just containing the names of the $_GET variables which can then be used in $_GET[$keys[0]] for example to recall its value.

array_keys($_GET);

Docs:

foreach loop array_keys()

array_keys() should do the trick:

$keys = array_keys($_GET);