Difference between revisions of "PHP/operator"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< PHP
Jump to navigation Jump to search
Line 1: Line 1:
 
==List==
 
==List==
 +
(very incomplete; mainly to document the more obscure ones)
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 
|-
 
|-

Revision as of 00:22, 16 September 2023

List

(very incomplete; mainly to document the more obscure ones)

operator name example meaning familiarity docs
== Equal $a == $b true if $a is equal to $b after type juggling. common Comparison Operators
=== Identical $a === $b true if $a is equal to $b, and they are of the same type. common-ish Comparison Operators
!= Not equal $a != $b true if $a is not equal to $b after type juggling. common Comparison Operators
<> Not equal $a <> $b true if $a is not equal to $b after type juggling. common
!== Not identical $a !== $b true if $a is not equal to $b, or they are not of the same type. common
< Less than $a < $b true if $a is strictly less than $b. common
> Greater than $a > $b true if $a is strictly greater than $b. common
<= Less than or equal to $a <= $b true if $a is less than or equal to $b. common
>= Greater than or equal to $a >= $b true if $a is greater than or equal to $b. common
<=> spaceship $a <=> $b An int less than, equal to, or greater than zero when $a is less than, equal to, or greater than $b, respectively. common
?: ternary $A ? $B : $C "if $A is true, then $B, else $C" less common
?? null coalescing $A ?? $B "$A if it isn't NULL, else $B" rare Comparison Operators: Null Coalescing Operator

Docs