Should entries be deleted from both arrays or just one after saving the results in the result array?

When saving results from two arrays into a result array, it is common practice to delete the entries from the original arrays. This ensures that the data is not duplicated or processed multiple times. Therefore, entries should be deleted from both arrays after saving the results in the result array.

// Sample arrays
$array1 = [1, 2, 3];
$array2 = [4, 5, 6];
$result = [];

// Save results from both arrays into the result array
$result = array_merge($result, $array1);
$result = array_merge($result, $array2);

// Delete entries from both arrays
$array1 = [];
$array2 = [];

// Display the result array
print_r($result);