In the following code:
$a = 0 or 1; $b = 0 || 1; echo "$a, $b"; // 0, 1
Why $a is zero, I thought that or and || are interchangeable in PHP? What exactly happens with the or operator to return it 0 ?
I would suggest that both results would be 1 , making it echo 1, 1 .
source share