Are there alternative methods in PHP to assign values to variables in arrays without affecting the original variable values?

When assigning values to variables in arrays in PHP, the original variable values can be affected if they are passed by reference. To avoid this, you can use the `array_merge()` function to create a new array with the updated values without modifying the original variables.

// Original variables
$var1 = "Hello";
$var2 = "World";

// Create a new array with updated values
$newArray = array_merge(["var1" => $var1, "var2" => $var2]);

// Update values in the new array without affecting the original variables
$newArray["var1"] = "Goodbye";
$newArray["var2"] = "Universe";

// Output the new array
print_r($newArray);