note 35621 deleted from function.isset by sobak
| From: | sobak@php.net | Date: | Sat, 10 Dec 2016 09:56:14 +0000 |
| Subject: | note 35621 deleted from function.isset by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208419@lists.php.net to get a copy of this message | ||
Note Submitter: flobee at gmx dot net
----
just as note: if you want to check variables by boolean value: true or false , "isset" has
a different meaning!
<?php
$var=null;
// sample 1
if($var) {
// if true or another value exept "false" , "null": go on here
echo "1. var is true or has a value $var<br>";
} else {
echo "1. var is "false" or "null"<br>";
}
if(!$var) {
// if false or "null": go on here
echo "2. var has no value $var<br>";
} else {
echo "2. var is "false" or "null"<br>";
}
// sample 2
$var =false;
if(isset($var)) {
// $var is false so it is set to a value and the execution goes here
echo "3. var has value: $var<br>";
}
$var=null;
if(!isset($var)) {
// $var is null (does not exist at this time) and the execution goes here
echo "4. var was not set $var<br>";
}
?>