Traversing Arrays Using foreach in PHP

$users = array("Mani", "Nani", "Item", "Raja");
print "The users are:\n";
foreach ($users as $key => $value) {
print "#$key = $value\n";
}

Output:
The players are:
#0 = Mani
#1 = Nani
#2 = Item
#3 = Raja

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.