I have tried the following code:
<?php
echo gettype($x);
?>
And I got the following output:

Why did gettype() outputted "NULL" after the error was displayed? I mean an undefined variable is a variable that doesn't exist and not a NULL variable, right?
The documentation of NULL explains:
The special
NULLvalue represents a variable with no value.NULLis the only possible value of typenull.A variable is considered to be
nullif:
- it has been assigned the constant
NULL.- it has not been set to any value yet.
- it has been
unset().
Also check the table "Comparisons of $x with PHP functions".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With