Values stored in $_GET
and $_POST
can only be strings or arrays, unless explicitly set at run-time. If you have a query string of query=string
the value is "string"
if you instead use: query=null
the value will be "null"
. Note that it is therefor a string.
If you send: query=
, the value will be ""
or the empty string. Take note of the differences between isset
and empty
. isset
will be true if the value is not null, whereas empty
will be true when the value evaluates to false
. Therefor ""
will be true for both isset
and empty
.
If you just want to check if a query string parameter was set to the string value of "null"
, you can simply check $_GET['query']=='null'
(you may want to adjust the case of the characters before the check)