Php uses the for statement to output a triangle, which is a phpfor statement triangle. Php uses the for statement to output triangles. This document describes how php outputs triangles using the for statement. Share it with you for your reference. Specific Implementation methods php uses the for statement to output triangles, phpfor statement triangles
This example describes how php outputs triangles using the for statement. Share it with you for your reference. The specific implementation method is as follows:
<? Php // phpinfo (); function Dis ($ num) {if ($ num <= 0) return; $ tmpRow = 0; for ($ I = 1; $ I <= $ num; $ I ++) {$ tmpRow = $ I <= $ num/2? $ I: $ num-$ I + 1; echo str_repeat ('*', 2 * $ tmpRow-1 ).'
';} Dis (19);?>
I hope this article will help you with php programming.
Examples in this article describes how php outputs triangles using the for statement. Share it with you for your reference. Implementation method...