Just wondering about the performance impact on copying very large php variables. For example, let's say $ arr is a huge array. If I do $ arr2 = $ arr, is it a deep copy or is $ arr2 just a pointer to $ arr, like Java? Thanks in advance.
$arr2 = $arr creates a deep copy. But actual copying only happens when $ arr2 changes - PHP uses copy-on-write.
$arr2 = $arr
If you want to use a "pointer" instead of a copy, use $arr2 =& $arr , which makes $ arr2 a reference to $ arr.
$arr2 =& $arr
If you use $ arr2 = & $ arr;
It will refer to $ arr.
A general rule in PHP is not creating links unless you need the functionality they provide. Links will do the code otherwise.
http://www.php.net/manual/en/language.references.php