Php | | what does the operator mean here?

Today I saw a line of code in the project:

foreach ($groupInfo as $k=>$v)
{
    $groupInfo[$k]["gIsOpen"] = false || ($a < $b);
}

to be honest, I"ve never seen this kind of writing before. Who can explain this line of code in foreach?

Php
Jul.10,2022

$a < $b ratio returns true/false,false | | false is false,false | | true is true, as follows:

var_dump (false | | (1 < 2));
var_dump (false | | (2 < 1));


your'| |'(or) is a logical operator, and the result returned is Bool, and the interpretation of that code is also very simple.
according to the explanation of'| |'(or), as long as one of the two is true, the result is true, so if $a < $b is true, then the result is true and vice versa.


$groupInfo [$k] ['gIsOpen'] = false | | ($a < b). Why should the fasle be written? just judge it according to the AB value. Solve


first ($a < $b) is a logical operation
, and then the result is followed by false | | logical operation
finally, the result is assigned to $groupInfo [$k] [' gIsOpen']


.

actually, it's fine to write this way

foreach ($groupInfo as $k=>$v)
{
    $groupInfo[$k]['gIsOpen'] = $a < $b;
}

I don't know why the person who wrote this code is icing on the cake


superfluous action.!
in js, using this operation returns the value of the established one. A Boolean value is always returned in
php to indicate whether the expression is valid or not.

The

sentence false means that it is not true, but because of the existence of | |, the latter expression is tried, and then if the latter expression returns true, then this is true, otherwise it is not true. The final return value of
also depends on the Boolean value calculated by the later expression.


why this person wrote to false is in the front.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35c8c-2b325.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35c8c-2b325.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?