I can use isset($var) to check if the variable is not defined or null. (eg. checking if a session variable has been set before)
But after setting a variable, how do I reset it to the default such that isset($var) returns false?
I can use isset($var) to check if the variable is not defined or null. (eg. checking if a session variable has been set before)
But after setting a variable, how do I reset it to the default such that isset($var) returns false?
As of php 7.2 directly setting a variable is depreciated. You should not use it in this fashion you should look into using unset instead. https://www.php.net/manual/en/language.types.null.php
unset($v); will result in the same false when checking to see if the variable is null or unset.
isset($v) === false
is_null($v) === false