How can PHP be used to display data from an array in a browser?

To display data from an array in a browser using PHP, you can iterate through the array using a loop, such as a foreach loop, and echo out each element to the browser. This will allow you to dynamically display the array data on a webpage.

<?php
// Sample array with data
$data = array("Apple", "Banana", "Orange", "Grapes");

// Iterating through the array and displaying each element
foreach ($data as $item) {
    echo $item . "<br>";
}
?>