I understand that if $var = array()
, $var
will return true because even though the array is empty, it's still a set variable.
But $_GET
and $_POST
are not just arrays, they are arrays generated by PHP.
Why does PHP even set these variables if there's nothing to put in them? Is there something logical behind this that I'm missing?
therefore, $_GET is always available. This is the decision of the language developers.
http://www.php.net/manual/en/language.variables.superglobals.php