Is there any difference between pointers and references? When should I use references?
What actually this syntax does?
$a = &$b
Is there any difference between pointers and references? When should I use references?
What actually this syntax does?
$a = &$b
Do not use references! They can lead to unexpected behavoiur.
As at PHP.net: One of the key-points of PHP 5 OOP that is often mentioned is that "objects are passed by references by default". This is not completely true.
There are pointers and references, you can see it it example below.
This behavior is dangerous, because it alters variable you don't touch.
$b === $c // returns true
$youCantSayThisVariableIsRelated = null
$b === $c // returns false!