Difference between revisions of "PHP/operator"
< PHP
Jump to navigation
Jump to search
(Created page with "==List== {| class="wikitable sortable" |- ! operator || name || example || meaning || familiarity || docs |- | == || Equal || <syntaxhighlight lang=ph...") |
(→Docs) |
||
Line 30: | Line 30: | ||
==Docs== | ==Docs== | ||
− | * [https://www.php.net/manual/en/language.operators.comparison.php Comparison Operators] | + | * [https://www.php.net/manual/en/language.operators.php Operators] |
+ | ** [https://www.php.net/manual/en/language.operators.arithmetic.php Arithmetic Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.assignment.php Assignment Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.bitwise.php Bitwise Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.comparison.php Comparison Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.errorcontrol.php Error Control Operators]: the <code>@</code> operator | ||
+ | ** [https://www.php.net/manual/en/language.operators.execution.php Execution Operators]: the <code>``</code> (backtick) operator | ||
+ | ** [https://www.php.net/manual/en/language.operators.increment.php Incrementing/Decrementing Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.logical.php Logical Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.string.php String Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.array.php Array Operators] | ||
+ | ** [https://www.php.net/manual/en/language.operators.type.php Type Operators] | ||
+ | * [https://www.php.net/manual/en/language.operators.precedence.php Operator Precedence]: if it matters, use parentheses to make it unambiguous; precedence rules can change. |
Revision as of 19:46, 15 September 2023
List
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
- Operators
- Arithmetic Operators
- Assignment Operators
- Bitwise Operators
- Comparison Operators
- Error Control Operators: the
@
operator - Execution Operators: the
``
(backtick) operator - Incrementing/Decrementing Operators
- Logical Operators
- String Operators
- Array Operators
- Type Operators
- Operator Precedence: if it matters, use parentheses to make it unambiguous; precedence rules can change.