How can you access specific values in an array in PHP using variables for dynamic output?
When accessing specific values in an array in PHP using variables for dynamic output, you can use the variable as the index to access the desired value. This allows you to retrieve values based on dynamic input or conditions. By concatenating the variable with the array name inside square brackets, you can access the specific value stored at that index.
// Sample array
$fruits = array("apple", "banana", "cherry");
// Variable for dynamic output
$index = 1;
// Accessing specific value using variable
echo $fruits[$index]; // Output: banana