How can PHP be used to organize and display data in a structured format like a table?

To organize and display data in a structured format like a table using PHP, you can create an HTML table and populate it with the data you want to display. You can use PHP to loop through your data and output the rows and columns of the table dynamically.

<?php
// Sample data array
$data = array(
    array("Name" => "John Doe", "Age" => 25, "City" => "New York"),
    array("Name" => "Jane Smith", "Age" => 30, "City" => "Los Angeles"),
    array("Name" => "Michael Johnson", "Age" => 35, "City" => "Chicago")
);

// Output HTML table
echo "<table border='1'>";
echo "<tr><th>Name</th><th>Age</th><th>City</th></tr>";
foreach ($data as $row) {
    echo "<tr>";
    echo "<td>".$row['Name']."</td>";
    echo "<td>".$row['Age']."</td>";
    echo "<td>".$row['City']."</td>";
    echo "</tr>";
}
echo "</table>";
?>