lundi 26 juin 2017

Where is PHP7 variable assignment inside "if" condition documented?

I recently migrated from PHP5 to PHP7 and found the following did not work anymore by just poking around:

if ($row = mysqli_fetch_assoc($result)){
    <my_stuff>
}

Instead, I had to go:

$row = mysqli_fetch_assoc($result);
if ($row) {
    <my_stuff>
}

Where is this documented? Probably I'm going nuts but I haven't found anything related in PHP7 manual.

Aucun commentaire:

Enregistrer un commentaire