Skip to content

Instantly share code, notes, and snippets.

@tadeubdev
Last active August 7, 2021 12:51
Show Gist options
  • Select an option

  • Save tadeubdev/7c6ad25634e9978dab09ee3d78058a41 to your computer and use it in GitHub Desktop.

Select an option

Save tadeubdev/7c6ad25634e9978dab09ee3d78058a41 to your computer and use it in GitHub Desktop.
<?php
$value = 1;
// retorna true, pois o value é igual a 1 e menor que 2
if ($value === 1 and $value < 2) {
// code
}
// retorna true, o value não é igual a 2, mas é menor que 2
// ele entra na segunda expressão
if ($value === 2 or $value < 2) {
}
// lembrando que também poderia ser usado o && e ||, daria no mesmo
if ($value === 1 && $value < 2) {
// code
}
if ($value === 2 || $value < 2) {
// code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment