I'm using PHP 7.2.0
I wrote following code :
<?php
echo 1 <= 5 == 1;
?>
and I got following output in my web browser :
1
I expected none(false) or 0 to be the output but surprisingly I got 1
as an output.
I'm not able to understand how does the precedence get worked out here.
Can someone please explain me how the precedence got worked in this code in a step-by-step manner?
Thank You.
1 <= 5
is true
,
true == 1
is true
,
echo true
outputs 1
.
The precedence is:
echo (1 <= 5) == 1;