PHP Program to Display Multiplication Table

You are Here:

Using for Loop

In the following example, we will create and display the Multiplication Table for the given number (9) using for loop

Example

PHP Compiler
<?php $table = 9; $length = 10; $i = 1; echo "Multiplication table: $table <br>"; for($i=1; $i<=$length; $i++) echo "$i * $table = ".$i * $table. "<br>"; ?>

Using while Loop

In the following example, we will create and display the Multiplication Table for the given number (9) using while loop

Example

PHP Compiler
<?php $table = 9; $length = 10; $i = 1; echo "Multiplication table: $table <br>"; while($i <= $length) { echo "$i * $table = ".$i * $table. "<br>"; $i++; } ?>

Using do while Loop

In the following example, we will create and display the Multiplication Table for the given number (9) using do while loop

Example

PHP Compiler
<?php $table = 9; $length = 10; $i = 1; echo "Multiplication table: $table <br>"; do{ echo "$i * $table = ".$i * $table ."<br>"; $i++; }while($i <= $length); ?>

Reminder

Hi Developers, we almost covered 90% of String functions and Interview Question on PHP with examples for quick and easy learning.

We are working to cover every Single Concept in PHP.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author