PHP Snippet: Iterating through an array
$colorList = array(0 =>"red",1=>"green",2=>"blue",3=>"black",4=>"white");
foreach( $colorList as $key => $value){
echo "Key: $key, Val: $value ";
}
OUTPUT:
Key: 0, Val: red Key: 1, Val: green Key: 2, Val: blue Key: 3, Val: black Key: 4, Val: white