Write a program to print table of any number in php
PHP program to print table of a number: The below program prints table of a number using a loop. The PHP echo statement is used to output the result on the screen. DOCTYPE html>
<html>
<body>
php
$num = 9;
for($i=1; $i<=10; $i++)
{
$product = $i*$num;
echo "$num * $i = $product" ;
echo ' Output 9 * 1 = 9 9 * 2 = 18 9 * 3 = 27 9 * 4 = 36 9 * 5 = 45 9 * 6 = 54 9 * 7 = 63 9 * 8 = 72 9 * 9 = 81 9 * 10 = 90 Please Share PHP ProgramsA table of a number can be printed using a loop in program. Logic:
Example: We'll print the table of 7. Output: Feedback
Help Others, Please ShareView Discussion Improve Article Save Article View Discussion Improve Article Save Article In this article, we will see how to print the multiplication table of any given number using PHP. To make the multiplication table, first, we get a number input from the user and then use for loop to display the multiplication table. We use HTML and PHP to display the multiplication table. The HTML part is used to design a form to get the input from the user and the PHP part is used to execute the multiplication and display the results in table format. Example: PHP
$num"
Output: |