I have an array of objects. I know that objects get assigned by "reference" and arrays by "value". But when I assign the array, each element of the array is referencing the object, so when I modify an object in either array the changes are reflected in the other.
Is there a simple way to clone an array, or must I loop through it to clone each object?
$array = array_merge(array(), $myArray);