Created
August 9, 2021 21:46
-
-
Save tadeubdev/473798a707f9cd4bb6fc278d656a36f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $nome = "Padma"; | |
| $sobrenome = "Patil"; | |
| $casa = "Corvinal"; | |
| if ($nome === "Luna" && $sobrenome === "Lovegood" or $casa === "Corvinal") { | |
| // retorna true, pois priorizou o or | |
| } | |
| if ($nome === "Luna" and $sobrenome === "Lovegood" or $casa === "Corvinal") { | |
| // retorna true, pois o or, por estar mais a direira, foi priorizado | |
| } | |
| if ($nome === "Luna" and $sobrenome === "Lovegood" || $casa === "Corvinal") { | |
| // retorna false, pois o and foi priorizado | |
| } | |
| if ($nome === "Luna" && $sobrenome === "Lovegood" || $casa === "Corvinal") { | |
| // retorna true, pois retornou true na segunda condição | |
| } | |
| if (($nome === "Luna" and $sobrenome === "Lovegood") || $casa === "Corvinal") { | |
| // retorna true, pois isolou a primeira condição entre parenteses, | |
| // executou primeiro, depois a segunda | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment