PHP isset() function is used to check whether the variable has been set and assigned a value. Returns true if set, false if not set or null.
Usage of isset() function in PHP
isset() function is used to check whether the variable has been set and is assigned a value. Returns true if the variable has been set, and returns false if the variable has not been set or is null.
Syntax
<code class="php">isset($variable);</code>
Parameters
Return value
Example
<code class="php"><?php $name = "John Doe"; $age = null; if (isset($name)) { echo "Name is set and has a value of $name"; } if (!isset($age)) { echo "Age is not set or is null"; } ?></code>
Advantages
Note
The above is the detailed content of How to use isset in php. For more information, please follow other related articles on the PHP Chinese website!