There is no difference in itself, it is a matter of habit, but sometimes it involves issues of operator precedence, and the results will be different, so record them.
For example:
Copy code The code is as follows:
$p = 6 or 0;
var_dump($ p);//int(6)
$p = 6 || 0;
var_dump($p);//bool(true)
$p = 6 and 0 ;
var_dump($p); //int(6)
$p = 6 && 0;
var_dump($p); //bool(false)
Because the priority of the assignment operation is higher than AND and OR, the value is assigned first; it is lower than && and ||, so the logical operator is executed first, the logical operation is performed first, and then the value is assigned.
http://www.bkjia.com/PHPjc/824937.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824937.htmlTechArticleThere is no difference in itself, it is a matter of habit, but sometimes it involves issues of operator precedence, the results will be different, record Down. For example: Copy the code The code is as follows: $p = 6 or 0; var_dump...