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.
Copyright © 2026 eLLeNow.com All Rights Reserved.