October 2002
Intermediate to advanced
368 pages
7h 12m
English
PHP support for operators includes the following:
PHP supports the standard mathematical operators:
$a = 4; $b = 2; //Addition: $a + b = 6 //Subtraction: $a - $b = 2 //Multiplication: $a * $b = 8 //Division :$a / $b = 2 //Modulus (remainder of $a / $b): $a % $b = 0 //Increment: $a++ (would equal 5 since $a = 4)
The two main assignment operators in php are “=” and “.”. The equals sign should be obvious; it assigns a value to a variable:
$a = 4; $b = $a; // $b = 4
PHP supports the standard comparison operators, as shown in Table 1-1:
| OPERATOR | DESCRIPTION |
|---|---|
| $a == $b | test if two values are equal |
| $a != $b | test if two values are not equal ... |
Read now
Unlock full access