Voting

: four minus one?
(Example: nine)

The Note You're Voting On

Mark Simon
5 years ago
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
}
?>

<< Back to user notes page

To Top