Operator || and the OR operator does not behave the same. They cannot be used interchangeably.
If you want behavior || use it. Do not use OR unless you are in a situation where || will do the wrong thing.
For your situation, these two lines of code will behave exactly the same:
$value = $a OR $b OR $c; ($value = $a) OR $b OR $c;
In other words, your code is mostly fair:
$value = $a;
If you used the || operator , then these two are identical, as if you had such braces:
$value = $a || $b || $c; $value = ($a || $b || $c);
More details: http://php.net/manual/en/language.operators.precedence.php
source share