| Home > Computer & I'net > for loops... |
|
|
|||||||||||||||
|
|
|||||||||||||||
|
||||||||||||||||
for loops | |
for (initial expression; condition test; closing expression){ block of coding here; } initial expression is assigning a value to start with (usually the start of a counter). condition test tests the current status to determin if the loop should happen or not. closing expression affects the current status (usually increasing or decreasing). An Example : <?php for ($test=0; $test<10; $test++){ echo "$test is less than 10. <br />"; } ?> Results : 0 is less than 10.
1 is less than 10. 2 is less than 10. 3 is less than 10. 4 is less than 10. 5 is less than 10. 6 is less than 10. 7 is less than 10. 8 is less than 10. 9 is less than 10. What's happening : ----------------- Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission. | |
| Articles |
•Auto & Trucks•Business•Computer & I'net·General·Apache·CSS·Database·Hardware·HTML·Javascript&DHTML·Linux·MySQL·Operating System·Perl / CGIPHP·Programming·Publishing·Search Engines·Software Problems·SSI·Tips & Tricks·Utilities·Web Design•Family•Food & Drink•Gardening•Health•Other•Pets•Psychology•Spiritual•Travel•Women |
| Calculators |
|