Re: PHP boolean's



..oO(Michael Sharman)

I suppose I can also do;

if(!($count % 2))

Yes. But even if this is documented behaviour, it's usually recommended
to explicitly write what you want to test for. In this case you're not
testing a boolean value ('!' is a logical operator), but an arithmetic
expression. So you should better write it as

if ($count % 2 == 0) {
...
}

This is cleaner and more readable code. Another example: The typical
shorthand way for testing if an array is empty or not is

if (!$someArray) {
...
}

But the better way is

if (empty($someArray)) {
...
}

Micha
.