How can you access and output specific values from an array fetched from a database query in PHP?

To access and output specific values from an array fetched from a database query in PHP, you can use the array index or associative keys to retrieve the desired values. You can loop through the array and access each element by its index or key. Alternatively, you can use functions like `array_column()` to extract specific columns from the array.

// Assuming $result is the array fetched from the database query
// Accessing and outputting specific values from the array
foreach ($result as $row) {
    echo $row['column_name']; // Output specific column value using associative key
}

// Using array_column() to extract specific column values
$specificColumn = array_column($result, 'column_name');
print_r($specificColumn);