O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Assignment Operators

There really is only one assignment operator, but PHP offers a handful of shortcut operators for combining assignment with another operator. Table 2.10 lists all the assignment operators.

All the assignment operators put a value into a variable. Specifically, they put a value on the right side into a variable on the left side. You may not reverse the order. The operators that combine another operator with an assignment operator operate on both the right and left sides and then put the result in the variable on the left. Listing 2.11 demonstrates equivalent statements.

Table 2.10. Assignment Operators
OperatorOperation Performed
=Assign right side to left side
+=Add right side to left side
-=Subtract right side from left side ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required