Home >Backend Development >PHP Tutorial >A concise version of the multiplication table implemented in PHP_PHP tutorial
This article mainly introduces a concise version of the multiplication table implemented in PHP. The code is concise and easy to understand and can be used Answer the interview questions, friends in need can refer to it
The multiplication table is also a program question in many interview exams. It tests the logical thinking ability of the PHP interviewer, mainly the understanding and application of algorithms. The following is the PHP code written by the editor in PHP to output the multiplication table. :
for($i=1;$i<=9;$i++)
{
for($j=1;$j<=$i;$j++)
{
echo “$i*$j=”.$i*$j.’ ‘;
}
echo ‘
;
}
?>
After reading it, is it very simple? It is just two loops. The outer layer controls the number of loop lines, and the inner layer controls the number of formulas input in each line.
Output result screenshot: