 June 12, 2002, 10:02:08 pm <--Previous Next -->

### Expressions and Operators

• = Assignment   \$a=5
• == Equality   if (\$a == 5)
• === Identical   if (\$a === \$b   Same value and of the same type.
• != or <> Not Equal   if (\$a != \$b)
• !== Not Identical   \$a !== \$b
• < Less Than   if (\$a < \$b)
• > Greater Than   if (\$a > \$b)
• <= Less than or equal to
• >= Greater than or equal to
• ++ Increment   \$a++   ++\$a
• -- Decrement   \$a--   --\$a
• -= Combined operator-assignment   -=   \$a-=5
• also +=,   *=,   /=
• Ternary conditional operator:   \$first ? \$second : \$third
• If the value of the first subexpression is TRUE (non-zero), then the second subexpression is evaluated, and that is the result of the conditional expression. Otherwise, the third subexpression is evaluated, and that is the value.
• Example:
 ```\$string=\$first ? \$second : \$third The above can be expressed like the following: if ( \$first ) { \$string = \$second ; } else { \$string = \$third ; } ```
• + Addition \$a + \$b
• - Subtraciotn - \$a - \$b
• * Multiplication * \$a * \$b
• / Division / \$a / \$b
• % Modulus \$a % \$b
• & And \$a & \$b
• | Or \$a | \$b
• ^ Xor \$a ^ \$b
• ~ Not ~ \$a
• << Shift left \$a<<\$b Shift the bits of \$a \$b steps to the left (each step means "multiply by two")
• >> Shift right \$a<<\$b Shift the bits of \$a \$b steps to the right (each step means "divide by two")
• @ Error Control Operator - Ignore error messages from an expression
• `` Execution Operators - Execute the given command
• . Concatination operator for strings
• .= Concatenating assignment operator  ``` \$a = "Hello "; \$b = \$a . "World!"; // now \$b contains "Hello World!" \$a = "Hello "; \$a .= "World!"; // now \$a contains "Hello World!" ```