Reputation: 656
I wanted to reproduce PHP version easter egg (http://www.0php.com/php_easter_egg.php).
As you can see, the get parameter has no name : ?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
I can check the URL with $_SERVER['REQUEST_URI']
, but is there a way to check using only the $_GET
array ?
I tried $_GET['']
but it doesn't appear to work.
Upvotes: 0
Views: 54
Reputation: 8030
This seemed interesting so I made a quick solution:
Request ?param1=asd¶m3=123&=PHPE9568F36-D428-11d2-A769-00AA001ACF42
PHP
function getFullRequest()
{
$tmp = explode('&', $_SERVER['QUERY_STRING']);
$request = [];
if (!empty($tmp) && is_array($tmp)) {
foreach($tmp as $item) {
$req = explode('=', $item);
if (!empty($req) && is_array($req)) {
$request[$req[0]] = $req[1];
}
}
}
return $request;
}
$request = getFullRequest();
var_dump($request);
Result
array (size=3)
'param1' => string 'asd' (length=3)
'param3' => string '123' (length=3)
'' => string 'PHPE9568F36-D428-11d2-A769-00AA001ACF42' (length=39) // <- necessary value
Upvotes: 1
Reputation: 26825
$_GET
is empty in this instance so no, it's not possible.
In addition to $_SERVER['REQUEST_URI']
you can use $_SERVER['QUERY_STRING']
though.
[QUERY_STRING] => =PHPE9568F36-D428-11d2-A769-00AA001ACF42
[REQUEST_URI] => /test.php?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
Upvotes: 1