PHP syntax: iterate over an array
Given the array:
$ar = array("one", "two", "three", "four", "five");
The third element in the array can be accessed with:
echo $ar[3];
The following code will step through the array one element at a time and print each element:
foreach ($ar as $a)
echo $a;






Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment