❮ PHP Variable Handling Reference
Example
Check whether a variable is empty. Also check whether the variable is set/declared:
and
will always echo 'false'. because the isset[] accepts VARIABLES as it parameters, but in this case, $foo->bar is NOT a VARIABLE. it is a VALUE returned from the __get[] method of the class Foo. thus the isset[$foo->bar] expreesion will always equal 'false'.
ayyappan dot ashok at gmail dot com ¶
6 years ago
Return Values :
Returns TRUE if var exists and has value other than NULL, FALSE otherwise.
Could any one explain me in clarity.
mandos78 AT mail from google ¶
14 years ago
Careful with this function "ifsetfor" by soapergem, passing by reference means that if, like the example $_GET['id'], the argument is an array index, it will be created in the original array [with a null value], thus causing posible trouble with the following code. At least in PHP 5.
For example:
will print
Array
[
]
Array
[
[unsetindex] =>
]
Any foreach or similar will be different before and after the call.
Cuong Huy To ¶
11 years ago
1] Note that isset[$var] doesn't distinguish the two cases when $var is undefined, or is null. Evidence is in the following code.