## print table in PHP| PHP program to print multiplication table from 1 to 10

Multiplication is define :  that a Mathematically operation where one number can multiply to other number, which symbolic representation is like :   a × b, a ⋅ b, a ∗ b, or ab,  where a and b are positive integerFor example 2 x 5 = 10 means 2 +  2 + 2 + 2 +2 = 10. Here a = 2 and b = 5. Means 2 added itself till b. print table in PHP we must be do an exercise on this.

### program to print table in PHP

``````<table align="center" border='1' width="100%">
<?php
// filename : multiplication_table.php
\$num = 10;

for(\$i = 1; \$i <= 10; \$i++)
{
echo "<tr>";

for(\$j =1; \$j <= \$num; \$j++)
{
\$multiplication_table = (\$i * \$j);
echo "<td>\$j  x \$i =  \$multiplication_table </td>";
}

echo "<tr/>";
}
?>
</table>``````

## Let’s Understand the logic to print table in PHP

• Define HTML table, which will show table in formatting
• Define \$num = 10, that mean, we are printing table till 10. as per your need you can increase this e.g. 12,15,20 …n
• Iterate outer loop till 10, because multiply will be up to 10. for ex. 2 X 1, 2 X 2, 2 X 3, …., 2 X 10.
• Print “<tr>” to start row of table inside of outer loop
• Iterate inner loop till \$num because, inner loop will be run till, multiplication want to print. e.g. \$num = 10; mean multiplcation will be print from 1 to 10, if we assigned \$num = 12 then multiplication will be print from 1 to 12.
• Inside inner loop multiplication of table printed in “<td>”, because table will loop in html format.
• finally close the </tr> outside of inner loop.
• finally close the “</table>” out side of PHP code. So that table is printing in HTML formats.

## Watch Video

I am a well-organized professional in Drupal Development and PHP web development with strong script handling knowledge or automation process with PHP. I awarded 2 times in year by my company for the best employee of the quarter. I never work to complete my working hours. I worked for only achievement.

### This Post Has 6 Comments

1. If you are going for most excellent contents like I do, simply pay a visit this web page everyday since it gives quality contents, thanks

2. Hello, I want to subscribe for this blog to obtain hottest updates,
therefore where can i do it please assist.

1. Hi Tangela,
Thanks for your great comment, For subscribe this blog: Scroll Down at bottom, there is form having field, name and email id and Subscribe button fill the form and click on subscribe. Later on will make another way to subscribe this blog.

3. Highly energetic article, I liked that a lot. Will there be a
part 2?

4. Fantastic post however I was wondering if you could write a litte
more on this subject? I’d be very grateful if you could elaborate a little bit further.
Thanks!

5. 