ConFoo Montreal 2026: Call for Papers

Voting

: one minus zero?
(Example: nine)

The Note You're Voting On

Mark Simon
5 years ago
Regarding the warning:

This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE.

Of course, this means that if you use:

<?php
if($entry = readdir($handle) == false)
?>

or

<?php
while($entry = readdir($handle))
?>

you may get a false false, as it were.

As far as I can tell, the only time this would actually occur is if you encounter an entry of 0.

According to

https://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting

this appears to be the only string which will evaluate to false.

<< Back to user notes page

To Top