Using the for Statement : for loop « Statement « PHP






Using the for Statement


<html>
<head>
<title>Using the for Statement</title>
</head>
<body>
<?php
for ( $counter=1; $counter<=12; $counter++ ) {
    print "$counter times 2 is ".($counter*2)."<br>";
}
?>
</body>
 </html>

           
       








Related examples in the same category

1.For statement without second condition
2.For statement without all three statements
3.For loop: Counting Backwards
4.For loop: Counting By Fives
5.Use for loop to output HTML table
6.For loop format
7.If statement inside a for loop
8.Nesting Two for Loops
9.A for Loop That Divides 4000 by Ten Incremental Numbers
10.A division table
11.A for Loop That Divides 4000 by Ten Incremental Numbers
12.A for loop in PHP
13.Alternating table row colors with for()
14.Loops Within Loops
15.Iterating through a multidimensional array with for()
16.Iterating through a numeric array with for()
17.Loop goes from 0 to 100 in steps of 0.1
18.Fahrenheit and Celsius table by for loop
19.Specifying a number after break, such as break 2, to break out of two loops or switch/case statements
20.Multiple expressions in for()
21.Nesting Two for Loops
22.Printing a
23.Printing out all the web-safe color codes