Prev | Current Page 162 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

Some examples of operands follow:
88 CHAPTER 3 ?–  PHP B ASICS
$a++; // $a is the operand
$sum = $val1 + val2; // $sum, $val1 and $val2 are operands
Operators
An operator is a symbol that specifies a particular action in an expression. Many operators
may be familiar to you. Regardless, you should remember that PHP??™s automatic
type conversion will convert types based on the type of operator placed between the
two operands, which is not always the case in other programming languages.
The precedence and associativity of operators are significant characteristics of a
programming language. Both concepts are introduced in this section. Table 3-4
contains a complete listing of all operators, ordered from highest to lowest precedence.
Table 3-4. Operator Precedence, Associativity, and Purpose
Operator Associativity Purpose
new NA Object instantiation
( ) NA Expression subgrouping
[ ] Right Index enclosure
! ~ ++ -- Right Boolean NOT, bitwise NOT, increment,
decrement
@ Right Error suppression
/ * % Left Division, multiplication, modulus
+ - . Left Addition, subtraction, concatenation
<< >> Left Shift left, shift right (bitwise)
< <= > >= NA Less than, less than or equal to, greater than,
greater than or equal to
== != === <> NA Is equal to, is not equal to, is identical to, is
not equal to
& ^ | Left Bitwise AND, bitwise XOR, bitwise OR
&& || Left Boolean AND, Boolean OR
?: Right Ternary operator
= += *= /= .


Pages:
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174