This is an expression
$city->visible = 0
Which evaluates to 0. So, you're essentially writing
if (0) { ... }
But 0
is a falsey value in PHP, so the IF block will never be called
Compare that to
$city->visible = 1
Which evaluates to
if (1) { ... }
1
is a truthy value in PHP, so the block IF will be called
Per your comment, please see
$a = 1; // this silently evaluates to 1; no visible output
echo $a = 0; // 0
echo $a; // 0