Untuk menambah jawaban lainnya.
$a = $b = $c = $d
sebenarnya berarti $a = ( $b = ( $c = $d ) )
PHP meneruskan tipe primitif int, string, etc.
berdasarkan nilai dan objek dengan referensi secara default.
Itu berarti
$c = 1234;
$a = $b = $c;
$c = 5678;
//$a and $b = 1234; $c = 5678;
$c = new Object();
$c->property = 1234;
$a = $b = $c;
$c->property = 5678;
// $a,b,c->property = 5678 because they are all referenced to same variable
Namun, Anda BISA melewatkan objek dengan nilai juga, menggunakan kata kunci clone
, tetapi Anda harus menggunakan tanda kurung.
$c = new Object();
$c->property = 1234;
$a = clone ($b = clone $c);
$c->property = 5678;
// $a,b->property = 1234; c->property = 5678 because they are cloned
TAPI, Anda TIDAK DAPAT melewatkan tipe primitif dengan referensi dengan kata kunci &
menggunakan metode ini
$c = 1234;
$a = $b = &$c; // no syntax error
// $a is passed by value. $b is passed by reference of $c
$a = &$b = &$c; // syntax error
$a = &($b = &$c); // $b = &$c is okay.
// but $a = &(...) is error because you can not pass by reference on value (you need variable)
// You will have to do manually
$b = &$c;
$a = &$b;
etc.