Home  >  Article  >  Backend Development  >  A concise version of the multiplication table implemented in PHP_PHP tutorial

A concise version of the multiplication table implemented in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:21:48864browse

A concise version of the multiplication table implemented in PHP

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:

php实现的九九乘法口诀表简洁版  帮客之家

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/852820.htmlTechArticleA concise version of the multiplication table implemented in PHP. This article mainly introduces the multiplication table implemented in PHP. Concise version, the code is concise and easy to understand, and can be used to answer interview questions. Friends who need it can...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn