Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php function factorial(int $n): int { return $n <= 1 ? 1 : $n * factorial($n - 1); } echo "<h3>Factorial Table</h3><table border=1 cellpadding=8 style='border-collapse:collapse'>"; echo "<tr style='background:#6366f1;color:white'><th>n</th><th>n!</th></tr>"; for ($i = 0; $i <= 10; $i++) { echo "<tr><td>$i</td><td>" . number_format(factorial($i)) . "</td></tr>"; } echo "</table>"; ?>
Result
Open