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
As suggested by AndreKR, using array_map() is the best way to go if you already know that your array contains objects:
$clone = array_map(function ($object) { return clone $object; }, $array);