Print Table of any Number In PHP


Copy Fullscreen Close Fullscreen
<?php
  /*define a function ti print a table. 
  *@param $number:int.
  */
  function print_table($number)
  {
    echo "Table of $number : <br/>";
    for($i=1 ; $i<=10 ; $i++)
    {
      echo $i*$number."<br/>";
    }
  }

  /*now try to print a table*/
  print_table(10);
  print_table(14);
?>
Output
Table of 10 :
10
20
30
40
50
60
70
80
90
100
Table of 14 :
14
28
42
56
70
84
98
112
126
140

Hey ! I'm Rahul founder of learnhindituts.com. Working in IT industry more than 4.5 years. I love to talk about programming as well as writing technical tutorials and blogs that can help to others .... keep learning :)

Get connected with me - LinkedIn Twitter Instagram Facebook