How can PHP be used to split text from a database column and display it in a specific format in an HTML table?

To split text from a database column and display it in a specific format in an HTML table, you can use the explode() function in PHP to separate the text into an array based on a delimiter. Then, you can iterate over the array to format the data as needed and display it in an HTML table.

<?php

// Assume $data is the text retrieved from the database column
$data = "John,Doe,30|Jane,Smith,25|Mike,Johnson,35";

// Split the text into an array based on the delimiter '|'
$rows = explode("|", $data);

// Display the data in an HTML table
echo "<table>";
echo "<tr><th>First Name</th><th>Last Name</th><th>Age</th></tr>";
foreach ($rows as $row) {
    $columns = explode(",", $row);
    echo "<tr>";
    foreach ($columns as $column) {
        echo "<td>$column</td>";
    }
    echo "</tr>";
}
echo "</table>";

?>