This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
uphp:functions:isset [2017/03/10 13:53] jeff created |
uphp:functions:isset [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
======isset====== | ======isset====== | ||
+ | |||
< | < | ||
- | Return 1 if the variable exists | + | Check if a variable exists |
====Description==== | ====Description==== | ||
- | <well size=" | + | |
- | <span style=" | + | <well size=" |
- | < | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
+ | <span style=" | ||
</ | </ | ||
Determine if a variable is set | Determine if a variable is set | ||
- | ====Parameters==== | + | ====Parameter==== |
- | < | + | |
- | ====Return Value==== | + | < |
- | 1 (true) if variable exists, 0 (false) if variable does not exist | + | |
- | ====Examples==== | + | ====Return Values==== |
- | <code php> | + | |
- | <? | + | |
- | print(isset($x)); | + | |
- | $x=0; | + | |
- | print(isset($x)); | + | |
- | $y=''; | + | < |
- | print(isset($y)); | + | |
- | $z=chr(0); | + | ====Examples==== |
- | print(isset($z)); | + | |
- | $array=array(); | + | <code php> |
- | print(isset($array)); | + | <? |
- | + | print(isset($x)); | |
- | $array[1]=" | + | $x=0; |
- | print(isset($array[0])); | + | print(isset($x)); |
- | print(isset($array[1])); | + | |
+ | $y=''; | ||
+ | print(isset($y)); | ||
+ | |||
+ | $z=chr(0); | ||
+ | print(isset($z)); | ||
+ | |||
+ | | ||
+ | print(isset($array)); | ||
+ | |||
+ | $array[1]=" | ||
+ | print(isset($array[0])); | ||
+ | print(isset($array[1])); | ||
?> | ?> | ||
</ | </ | ||
Line 45: | Line 50: | ||
====Notes==== | ====Notes==== | ||
- | There is no way to unset a variable once it has been set (except to exit the local scope or script where it was defined). Unlike mainline PHP, uPHP does not have a construct '' | + | There is no way to unset a variable once it has been set (except to exit the local scope or script where it was defined). Unlike mainline PHP, uPHP does not have a construct '' |
Also note that the uPHP [[isset()]] does not always generate a parsing error if the parameter is not a variable((See http:// | Also note that the uPHP [[isset()]] does not always generate a parsing error if the parameter is not a variable((See http:// | ||
Line 51: | Line 56: | ||
<code php> | <code php> | ||
<? | <? | ||
- | print(isset(1)); | + | |
- | print(isset(" | + | print(isset(" |
- | print(isset(array(1, | + | print(isset(array(1, |
- | print(isset(2+3)); | + | print(isset(2+3)); |
?> | ?> | ||
</ | </ | ||
Line 62: | Line 67: | ||
<code php> | <code php> | ||
<? | <? | ||
- | print(isset(z)); | + | |
?> | ?> | ||
</ | </ | ||
Line 75: | Line 80: | ||
====See Also==== | ====See Also==== | ||
- | [[is_int()]] - Return 1 if the variable is an integer | ||
- | [[is_float()]] - Return 1 if the variable is a float | + | [[is_int()]] - Check if a variable is an < |
+ | |||
+ | [[is_float()]] - Check if a variable is a < | ||
- | [[is_numeric()]] - Return 1 if the value is numeric (integer, float or numeric string) | + | [[is_numeric()]] - < |
- | [[is_array()]] - Return 1 if the variable is an array | + | [[is_array()]] - Check if a variable is an < |
- | [[is_string()]] - Return 1 if the variable is a string | + | [[is_string()]] - Check if a variable is a < |
[[uphp: | [[uphp: | ||