(PHP has || and OR. JS only has ||.)
JS. According to MDN || has higher precedence than =<
The expression $a || $a = 1; is equivalent to this:
if ( $a != true ) {
$a = 1;
}
A very common variant on the idea is used for poor-mans debugging:
$debug = true;
// Thousands of lines of code
$debug && printf("Foo: {$foo}");
// More code
$debug && printf("Bar: {$bar}");
In this paradigm, only the $debug statement needs to be set to true/false to enable/disable debugging. I'm not advocating this type of debugging, but I've seen it quite a few times.