What is the best practice for accessing values in an array in PHP?

When accessing values in an array in PHP, it is best practice to use square brackets with the index of the value you want to access. This ensures that you are directly targeting the specific element in the array without any ambiguity.

// Accessing a value in an array using square brackets
$array = [10, 20, 30, 40, 50];
$value = $array[2]; // Accessing the value at index 2 (30)
echo $value; // Output: 30