How can multiple solutions be displayed in a table using a CASE statement in PHP?
When using a CASE statement in PHP, you can display multiple solutions in a table by creating separate rows for each solution within the CASE statement. Each row should contain the different conditions and corresponding results. This way, when the CASE statement is executed, it will check each condition and display the corresponding result in the table.
<table>
<tr>
<th>Condition</th>
<th>Result</th>
</tr>
<?php
$value = 2;
switch ($value) {
case 1:
echo "<tr><td>Condition 1</td><td>Result 1</td></tr>";
break;
case 2:
echo "<tr><td>Condition 2</td><td>Result 2</td></tr>";
break;
case 3:
echo "<tr><td>Condition 3</td><td>Result 3</td></tr>";
break;
default:
echo "<tr><td>Default Condition</td><td>Default Result</td></tr>";
}
?>
</table>