Is there a function to make a copy of a PHP array to another?
In PHP, all variables except objects are assigned by the mechanism called copy-on-write, while objects are assigned by reference. Which means that for the arrays with scalar values simply $b = $a already will give you a copy: $a = array(); $b = $a; $b[‘foo’] = 42; var_dump($a); Will yield: array(0) { } Whereas with … Read more