Sorry David, I should have rephrased.
Is there any notable difference between using an existing PHP
function to
determine empty Versus using PHP function to compare strings
to empty values
$a = "";
if(!empty($a)){
print $a;
}
and this
if($a !=""){
$print $a;
}
Are there conditions one would catch and another would not?
For example, in
your code:
$a=0;
empty will see that as true (or empty), correct? Are there
any other
conditions where empty would not verify.
The reason I'm asking is I'm putting in error checking in a
lot of our
sites, and wish to know which I should be using.
I prefer empty(), as I think it looks cleaner, (and I think 0
values being
empty would be fine, as it would be an invalid record call),
but want to
make sure I don't need to use != "".
"David Powers" <david@example.com> wrote in message
news:eid503$25r$1@forums.macromedia.com...
> crash wrote:
>> Is there any major difference between empty and =
""?
>
> The empty() function checks whether a variable is empty,
as defined here:
>
>
http://www.php.net/manual/en/function.empty.php
>
> = "" sets a variable to an empty string.
>
> Do you mean the difference between using empty() and ==
""?
>
> If so, there is a major difference.
>
> $variable = 0;
>
> if (empty($variable)) // true
> if ($variable == "") // false
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
>
http://foundationphp.com/