3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cakedata = [ ["shape" => "Heart", "flavor" => "Chocolate", "toppings" => "Cookies"], ["shape" => "Rectangle", "flavor" => "Vanilla", "toppings" => "Spun-sugar Flowers"], ["shape" => "Square", "flavor" => "Lemon", "toppings" => "Mini Chocolate Candies"], ["shape" => "Round", "flavor" => "Cheesecake", "toppings" => "Marshmallows"] ]; $td = <<<'TD' <td><label><input type="radio" name="%1$s" value="%2$s" required>%2$s</label></td> TD; foreach ($cakedata as $row) { echo '<tr>'; foreach ($row as $attr => $value) { printf($td, htmlentities($attr), htmlentities($value)); } echo '</tr>'; }

preferences:
29.92 ms | 405 KiB | 5 Q