Expressions

Expressions are combinations of identifiers and operators. In most cases, they are the familiar formulas you learned about in high school algebra. They are executed from left to right; some operators are processed before others, and you can use parentheses to force an operation to occur before the rest of the expression. But since the expression may be a mix of different data types, you must be aware of how types are converted.

Listing 2.11. Using Assignment Operators
<?
     // this assignment
     $Count = $Count + 1;

     // is the same as this assignment
     $Count += 1;
?>

Two general rules are at work when an expression is evaluated. First, some operators work only on certain data types. Second, if the operation is on a mix of an integer and ...

Get Core PHP Programming: Using PHP to Build Dynamic Web Sites now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.