php isset 用法
isset() function is used to determine if a variable is set and is not NULL. It returns true if the variable exists and has a value other than NULL, and false otherwise.
Here is the basic syntax of using isset in PHP:
isset($var);
$var is the variable you want to check if it is set.
Example:
<?php
$var1 = "Hello";
$var2 = null;
echo isset($var1); // Output: 1 (true), as $var1 is set and has a value
echo isset($var2); // Output: nothing, as $var2 is set but has a null value
echo isset($var3); // Output: nothing, as $var3 is not set
>
It is also possible to use isset() on multiple variables simultaneously by separating them with a comma:
<?php
$var1 = "Hello";
$var2 = "World";
echo isset($var1, $var2); // Output: 1 (true), both $var1 and $var2 are set and have values
exists的用法echo isset($var1, $var3); // Output: nothing, $var3 is not set
>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论