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 integer. For 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.
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
Hello, I want to subscribe for this blog to obtain hottest updates,
therefore where can i do it please assist.
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.
Highly energetic article, I liked that a lot. Will there be a
part 2?
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!
Tremendous issues here. I am very glad to look your post.
Thanks a lot and I’m having a look forward to touch you.
Will you kindly drop me a mail?