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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> why this get wrong?
>
> <?php
>
> if (empty($a=5)) {
> echo 'ok';
> } else {
> echo 'bad';
> }
> ?>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to