Home >Backend Development >PHP Tutorial >A brief analysis of the usage of php isset() and unset() functions
This also works for elements in an array:
Note: Since this is a language structure rather than a function, it cannot be called by "variable functions" . Reasonable application of the php function isset() can help us detect whether the variable is set. Returns false if the variable does not exist, and true if the variable exists and is not null. Through studying the PHP language, you should know that it is a function-based HTML scripting language. A huge function library supports the implementation of PHP language functions. Down Related usage of php function isset(). Format: bool isset ( mixed var [, mixed var [, ...]] ) Function: Detect whether the variable is set return value: Returns false if the variable does not exist Also returns false if the variable exists and its value is null If the variable exists and the value is not null, return true When checking multiple variables at the same time, true will be returned when each single item meets the previous requirement, otherwise the result will be false Version: php 3, php 4, php 5 More instructions: After a variable is freed using unset(), it is no longer isset(). The php function isset() can only be used for variables. Passing any other parameters will cause a parsing error. Check whether a constant has been set using the defined() function. unset() Destroy the specified variable. Note that in PHP 3, unset() will return true (actually the integer value 1), while in PHP 4, unset() is no longer a real function: It is now a statement. There is no return value, and trying to get the return value of unset() will result in a parsing error. |