note 35495 added to function.array
| From: | TCross1 at hotmail dot com | Date: | Wed, 03 Sep 2003 05:38:40 +0000 |
| Subject: | note 35495 added to function.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55508@lists.php.net to get a copy of this message | ||
here is the sort of "textbook" way to output the contents of an array which avoids using
foreach() and allows you to index & iterate through the array as you see fit:
<?php
$arrayName = array("apples", "bananas", "oranges", "pears");
$arrayLength = count($arrayName);
for ($i = 0; $i < $arrayLength; $i++){
echo "arrayName at[" . $i . "] is: [" .$arrayName[$i] .
"]<br>\n";
}
?>
enjoy!
-tim
----
Manual Page -- http://www.php.net/manual/en/function.array.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35495
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35495&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35495&report=yes