What is the best practice for referencing and renaming array values in PHP?

When referencing array values in PHP, it is best practice to use the square brackets notation to access specific elements within the array. If you need to rename array values, you can simply assign a new value to the desired key within the array.

// Sample array
$fruits = array("apple", "banana", "cherry");

// Reference array values
echo $fruits[0]; // Output: apple

// Rename array values
$fruits[1] = "orange";
echo $fruits[1]; // Output: orange