Assignment Operators

The assignment operators set the values of variables either by copying the value or copying a reference to a value. They are shown in Table 6-2.

Table 6-2. The assignment operators

=

Assignment

Copies $b's value into $a, unless $b is an object, in which case the same object is in both places: $a = $b

=&

Reference

Set $a to reference $b: $a =& $b

Get PHP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.