“How can I create a table with content using PHP?”
To output a table with content, one first needs to write HTML code in PHP to create the table and fill it with content. Here is a simple example code:
<!DOCTYPE html>
<html>
<head>
<title>Table Example</title>
</head>
<body>
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>John</td>
<td>25</td>
<td>New York</td>
</tr>
<tr>
<td>Mary</td>
<td>30</td>
<td>Los Angeles</td>
</tr>
<tr>
<td>David</td>
<td>22</td>
<td>Chicago</td>
</tr>
</table>
</body>
</html>
In the code above, we created a simple table containing information about a person’s name, age, and city. By outputting this code with PHP, the table can be displayed on the page. You can save this code as a .php file and open it in a browser to see the output.