August 2005
Intermediate to advanced
840 pages
17h 29m
English
PHP supports the usual collection of standard operators, as shown in the following table:
PHP Arithmetic Operators
| Operator | Use |
|---|---|
| + | Addition |
| − | Subtraction |
| * | Multiplication |
| / | Division |
| % | Modulus |
| ++ | Increment |
| -- | Decrement |
PHP supports C-style pre and post types of increment and decrement operators. The pre operators (designated by placing the operators prior to the variable, for example, --$a) perform the operation and then return the value of the variable. The post operators (designated by placing the operators after the variable, for example, $a--) return the value of the variable and then perform the operation.
PHP Assignment Operators
| Operator | Use |
|---|---|
| = | Assignment |
| += | Increment assignment |
| −= | Decrement assignment |
| *= | Multiplication assignment |
| /= | Division assignment |
| %= | Modulus assignment |
PHP Comparison Operators
| Operator | Use |
|---|---|
| == | Is equal to |
| === | Exactly identical, in value and type |
| != | Is not equal to |
| !== | Is not identical |
| > | Is greater than |
| < | Is less than |
| >= | Is greater than or equal to |
| <= | Is less than or equal to |
PHP Logical Operators
| Operator | Use |
|---|---|
| && or and | And |
| || or or | Or |
| ! | Not |
| xor | Xor |
PHP Bitwise Operators
| Operator | bottom |
|---|---|
| & | And |
| | | Or |
| ^ | Xor |
| ~ | Not |
| << | Left shift |
| >> | Right shift |
PHP Miscellaneous Operators
| Operator | Use |
|---|---|
| ?: | Condition operator |
PHP String Operators
| Operator | Use |
|---|---|
| . | Concatenation |
| .= | Concatenation assignment |
PHP Array Operators
| Operator | Use |
|---|---|
| + | Union |
PHP String Tokens
| Token | Character |
|---|---|
| \b | Backspace |
| \t | Horizontal tab |
| \n | Line feed |
| \v | Vertical tab |
| \f | Form teed |
| \r | Carriage return |
| \" | Double-quote |
| \' | Single-quote |
| \\ | Backslash |
Read now
Unlock full access