Welcome to PHPMule.com
A blog site which I am posting to during my learning of the popular programming language PHP. Feel free to leave comments!
-
PHP - Using Loops With Arrays
There’s an even better way of displaying a numerical array’s contents by using a loop because the array is basically indexed by numbers.
We can use a ‘for’ loop to do this:
for ($counter = 0; $counter<10; $counter++) {
echo $celebrity_array[$counter] . ” “;
}
There’s another loop which you could use which was designed for arrays in the first place and that’s the ‘foreach’ loop:
foreach ($celebrity_array as $action_heroes) {
echo $action_heroes. ” “;
}
Here is a while loop that uses the each construct.
while ($variable = each($numbers)) {
echo $element['key'];
echo ” - “;
echo $element['value'];
echo “<br />”;
}
(Post created on Monday, April 13th 09 at 14:15)
1 Trackbacks / Pingbacks
-
Buy:Soma.Viagra Soft Tabs.Cialis Soft Tabs.Zithromax.Viagra.Propecia.Maxaman.Viagra Professional.Cialis.Viagra Super Active+.Levitra.Cialis Professional.Viagra Super Force.Super Active ED Pack.VPXL.Tramadol.Cialis Super Active+….
Leave a reply
-
-
Archives
Recent Articles
- PHP - Rounding Off Numbers
- PHP - Single vs Double Quotation Marks
- PHP - Loading Files Into Your PHP Script By Using require() and include()
- PHP - Replacing Strings With Other Strings
- PHP - Finding Strings Within Strings
- PHP - Using strlen() To Test String Length
- PHP - Using The explode() Function
- PHP - Changing The String Case
- PHP - The nl2br() Function
- PHP - Trimming Strings
Links
Categories
- PHP (22)
- Uncategorized (1)



VIRGIL September 8th, 2010 at 02:34