Skip to content

Instantly share code, notes, and snippets.

@geekcom
Created April 23, 2017 15:51
Show Gist options
  • Save geekcom/0ab5afb74917670c7987f22c8841bf6f to your computer and use it in GitHub Desktop.
Save geekcom/0ab5afb74917670c7987f22c8841bf6f to your computer and use it in GitHub Desktop.
<?php
// considere os valores a esquerda sendo $a e os valores a direita $b
echo 1 == 1;
echo 1 != 2;
echo 1 <> 2;
echo 1 === 1;
echo 1 !== 2;
echo 2 > 1;
echo 1 < 2;
echo 2 >= 2;
echo 1 <= 2;
// operador spaceship
echo 1 <=> 2; // $a < $b então o resultado é -1
echo 1 <=> 1; // $a == $b então o resultado é 0 (zero)
echo 2 <=> 1; // $a é maior que $b então o resultado é 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment