Is there a consensus on whether inter-array references are retained upon return or replaced by the contents in PHP?

In PHP, inter-array references are retained upon return, meaning that the original array is modified when changes are made to the returned array. To avoid this behavior and prevent modification of the original array, you can use the `array_merge()` function to create a new array with the contents of the returned array.

// Original array
$array1 = ['a', 'b', 'c'];

// Function that returns an array with modifications
function modifyArray($array) {
    $array[0] = 'x';
    return $array;
}

// Create a new array with the contents of the returned array
$newArray = array_merge([], modifyArray($array1));

print_r($array1); // Output: ['a', 'b', 'c']
print_r($newArray); // Output: ['x', 'b', 'c']