PHP Online Compiler
Example: Multiplication table in PHP using Function
C
C++
C#
Java
Python
PHP
main.php
STDIN
Run
<?php // Multiplication table in PHP using Function $x = 15; $r = 12; echo "----The input number is: ", $x, "\n"; echo "\n----The range number is: ", $r, "\n"; // $x - To store the input number // $r - To store the multiplication range MultiplicationTable($x, $r); // This function will print the multiplication table function MultiplicationTable($x, $y) { echo "\n----The above multiplication table--------\n\n"; $i = 1; while ($i <= $y) { echo "\t", $x, " * ", $i, " = ", $x * $i, "\n"; $i++; } } ?>
Output
Clear
ADVERTISEMENTS