What is the best practice for storing values from one array into another array in PHP?

When storing values from one array into another array in PHP, the best practice is to use a loop to iterate through the original array and assign each value to the new array. This ensures that all values are transferred accurately without missing any elements.

$originalArray = [1, 2, 3, 4, 5];
$newArray = [];

foreach ($originalArray as $value) {
    $newArray[] = $value;
}

print_r($newArray);