Assignment Operator

The basic assignment operator is “=”. Your first inclination might be to think of this as “equal to”. Don’t. It really means that the the left operand gets set to the value of the expression on the rights (that is, “gets set to”).

The value of an assignment expression is the value assigned. That is, the value of “$a = 3″ is 3. This allows you to do more than one assignment at a time:

  a = b = 5; // a is set to b and b is set to 5, so both a and b have been set to 5.  

Note that the assignment copies the original variable to the new one (assignment by value), so changes to one will not affect the other.

Assignment Operator