2022/10/25

From Woozle Writes Code
Jump to navigation Jump to search
$t1 = FALSE or TRUE;
$t2 = FALSE || TRUE;
echo "T1=[$t1] T2=[$t2]\n"; die();

Output:

T1=[] T2=[1]

That... does not seem right.

Ahh, this offers a clue -- changing the first line to this --

$t1 = (FALSE or TRUE);

-- does in fact fix the problem:

T1=[1] T2=[1]

...but that's totally not the evaluation-order I would have set as the default. "=" should be last.