A lot of people here are saying the value of a $_GET['para1']
is null
but that is not the case. There is a comment on the php.net $_GET docs that provides a useful script to test this.
Given the URL: http://www.example.com?a
You can use this script to test results:
<?php
print_r($_GET);
if($_GET["a"] === "") echo "a is an empty string
";
if($_GET["a"] === false) echo "a is false
";
if($_GET["a"] === null) echo "a is null
";
if(isset($_GET["a"])) echo "a is set
";
if(!empty($_GET["a"])) echo "a is not empty";
?>
</pre>
The output would be:
a is an empty string
a is set
This is the case because a key without a value is actually an empty string not null
So to directly answer your question:
Even though it does not appear para1
has a value set, it actually does. The value is an empty string (""
). Even though this value is falsy, it is still a value and as such, isset()
returns true. You can use !empty()
to return false on empty strings. See a comparison of isset()
empty()
and is_null()
here.