3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>JS Bin</title> <style type="text/css"> table.tb {border-collapse:collapse; width:100%; margin:0px 20px;} table.tb td {border:1px solid red; width:3%;} table.tb th {text-align:left; color:blue; } th span {margin-left:-20px;}; td input[type=checkbox]:checked + span {color:green;} </style> </head> <body> <?php error_reporting(0); $numRow=3; $numCol=18; $i=$j=1; echo "<table class=\"tb\">"; while($i<=$numRow) { echo "<tr>"; if ($i==1) { while($j<=$numCol) { $tIncrement=30*($j-1); $time=date("H:i",strtotime("08:00+ $tIncrement minute")); echo "<th><span>$time</span></th>"; $j++; } } else { while($j<=$numCol) { echo "<td><input type=\"checkbox\" name=\"slot\" ><span>slot</span></td>"; $j++; } } $j=1; echo "</tr>"; $i++; } echo "</table>"; ?> </body> </html>

preferences:
39.92 ms | 402 KiB | 5 Q