布尔表达式如何依赖于评估顺序和赋值?

When I evaluate the expressions below, the result is completely different depending on the evaluation order and whether I assign the value or not:

$a = true;
$b = false;
var_dump($a and $b); // false

$c = $a and $b;
var_dump($c); // true

$d = $b and $a;
var_dump($d); // false

I'm completely stumped. Why does this happen?

= has higher priority than and. So $c = $a and $b; is the same as ($c = $a) and $b;, value of $a is assigned to $c. This is different from && which has higher priority than =, so $c = $a && $b evaluates to $c = ($a && $b);

$c = ($a && $b);  // will fix the problem