How To Use For Loop In Php Using Array Tutorial Sample Script

RegisterLogin
How To Use For Loop In Php Using Array Tutorial Sample Script
Post Description: How To Use For Loop In Php Using Array Tutorial Sample Script
Tags: How, To, Use, For, Loop, In, Php, Using, Array, Tutorial, Sample, Script
This Post Was Posted On Feb 29, 2008 By web hosting #1295
its easy to use the for loop



lets say i want to display numbers 1 to 10 i would do this:




PHP CODE:

<?php
for($counter =1; $counter <= 10; $counter++) {
print("counter is $counter<br>n");
}
?>





this would be the output:


counter is 1

counter is 2

counter is 3

counter is 4

counter is 5

counter is 6

counter is 7

counter is 8

counter is 9

counter is 10


hostman
#1723 1
not lets get more creative. how about if we can assign these values to an array?
Feb 14, 2008 Reply Report abuse
©2011 Webune Forums - Fri Dec 23, 2011 7:11 pm
Powered by: Webune Forums V3