3v4l.org

run code in 300+ PHP versions simultaneously
<?php $target = array(1,2,3,4,5,6,7,8,9,10,11,12,13); $target = array_chunk($target, 3); //Split the array into chunks of 3. $result = array_map(function ($el) { return implode("</td><td>", $el); //Implode the inner arrays with table cells }, $target); $result = implode("</td></tr><tr><td>", $result); //Implode the outer arrays with table rows. echo "<table><tr><td>"; echo $result; echo "</td></tr></table>";

preferences:
25.43 ms | 406 KiB | 5 Q