Re: what is the difference between function and language construct?
| From: | David Duong | Date: | Sat, 23 Mar 2002 00:40:05 +0000 |
| Subject: | Re: what is the difference between function and language construct? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89796@lists.php.net to get a copy of this message | ||
empty -- Determines whether a variable is set
gives a boolean result.
$var = 0;
if (empty($var)) { // evaluates true
echo '$var is either 0 or not set at all';
}
if (!isset($var)) { // evaluates false
echo '$var is not set at all';
}
I don't think that
<?php
if (empty($a=5)) {
echo 'ok';
} else {
echo 'bad';
}
?>
would work. Try:
If you want to see if variable is empty, if it is change it to 5.
<?php
if (empty($var)) {
echo 'ok';
} else {
echo 'bad';
$a=5;
}
?>
------ OR ----------
If you what to see if $a == 5 than
<?php
if ($var==5) {
echo 'ok';
} else {
echo 'bad';
$a=5;
}
?>
"Bob" <lly200146@sohu.com> wrote in message
news:qftk9uogr3jk66ov1i26o57tssd73m5svk@4ax.com...
> why this get wrong?
>
> <?php
>
> if (empty($a=5)) {
> echo 'ok';
> } else {
> echo 'bad';
> }
> ?>
>