It depends on what you assign.
If you assign a value, the assignment copies the original variable to a new one.
Example 1:
$a = $b = 0; $b++; echo $a;
Above, the code will return 0 as a destination by value.
Example 2:
$a = ($b = 4) + 5; // $a is equal to 9 now, and $b has been set to 4.
An exception to the usual assignment of behavior to values ββin PHP occurs with objects that are automatically assigned a reference to PHP 5. Objects can be explicitly copied using the clone keyword.
Example 3
$a = $b = $c = new DOMdocument(); $c->appendChild($c->createElement('html')); echo $a->saveHTML();
<html></html> will be printed above the code.
kenorb Feb 21 '15 at 18:05 2015-02-21 18:05
source share