[problem]
You want to create an array, then traverse it.
[/problem]
[solution]
Following up from part one – working with arrays.
To spin through all elements in our names array, here is the code below.
[/solution]
[example]
<?php
$count=count($names);
for ($i=0;$i<$count;$i++) { print($names[$i]."n"); }
?>
Then for our string index array (hash):
<?php
while(list($k,$v)=each($addresses)) {
echo "$k lives at $vn";
}
?>
[/example]
[reference]
[tags]PHP Arrays, PHP Hashes, PHP Coding School[/tags]
[/reference]
If you have found my website useful, please consider buying me a coffee below 😉