The difference between OR and || AND and && in php
WBOY
Release: 2016-07-25 08:57:46
Original
1315 people have browsed it
$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)
var_dump($p); //bool(false)
Copy code
Because the assignment operation has a higher priority than AND and OR, so first Assignment; is lower than && and ||, so logical operators are executed first, logical operations first, and then assignment.
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn