function numbers_func($number) { print $number; if ($number < 5) { numbers_func(++$number); } }
<?php //завдання 1 . function numbers_func($a = 0) { for ($i = 1; $i <= $a; $i++) { print $i . ' '; } } numbers_func(5); //завдання 2 function mult($a = 0) { print '<table border="1" cellspacing="0">'; for ($i = 1; $i <= $a; $i++) { print '<tr>'; for ($x = 1; $x <= $a; $x++) { if ($i == 1 || $x == 1) { print "<td><strong>" . $i * $x . "</strong></td>"; } else { print "<td>" . $i * $x . "</td>"; } } print '</tr>'; } print '</table>'; } mult(20); //завдання 3 function number_to_text($a = 0) {
<?php function numbers_func($y) { for ($x = 0; $x <= $y; $x++) { print $x; } } numbers_func(8);
<?php function numbers_func($y) { $x = 0; do { $x++; print $x; } while ($x < $y); } numbers_func(10);
<?php function numbers_func($y) { $x = 0; while ($x < $y) { $x++; print $x; } } numbers_func(15);