PHP includes and alternative boolean operators whose precedence is below assignment. This means that an expression of the form
<?php
if(($a = something()) && $a !== false) … ;
?>
can be written as
<?php
if($a = something() and $a !== false) … ;
?>
In this case, the loop can be written as:
<?php
while ($entry = readdir($handle) and $entry !== false) {
// etc
}
?>