How do you make multiplication table using php functions?

1 answer

Answer

1247335

2026-08-14 15:25

+ Follow

To create a multiplication table using PHP functions, you can define a function that takes a number as an argument and generates the table. Inside the function, you can use a for loop to iterate from 1 to 10 (or any desired range) and calculate the product of the input number and the loop index. You can then print each line of the multiplication result. Here’s a simple example:

<code class="language-php">function multiplicationTable($number) {

for ($i = 1; $i <= 10; $i++) { echo "$number x $i = " . ($number * $i) . "<br>"; } }

multiplicationTable(5); // Example call

</code>

This will produce the multiplication table for the number 5.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.