Table of Any Number in PHP

In programming, calculating the table of any number involves performing mathematical operations to generate a sequence of values. Mathematical tables provide a systematic representation of multiplication results with different arguments.

PHP Example:

Let’s calculate the table of the number 3 using PHP:

// Take any number. For example, we'll calculate the table of 3.
$number = 3;

// Using a loop to calculate and display the table up to 10.
for ($i = 1; $i <= 10; $i++) {
    // Multiply the current index by the chosen number.
    $result = $i * $number;

    // Display the result with a line break for better readability.
    echo $result . '<br>';
}

Output:

3
6
9
12
15
18
21
24
27
30