3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $names = array("John","Harry","Sam","Jake","Frank","Robert","Henry","Al"); $td = 1; echo "<table border='1' cellpadding='10' cellspacing='10'>"; echo "<tr>"; foreach($names AS $value) { echo "<td>".$value."</td>"; $td++; if($td >= 4){ echo "</tr>"; $td = 1; } } ?>
Output for 4.3.0 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.12
<table border='1' cellpadding='10' cellspacing='10'><tr><td>John</td><td>Harry</td><td>Sam</td></tr><td>Jake</td><td>Frank</td><td>Robert</td></tr><td>Henry</td><td>Al</td>