1$index = 0;
2foreach($data as $key=>$val) {
3 // Use $key as an index, or...
4
5 // ... manage the index this way..
6 echo "Index is $index\n";
7 $index++;
8}
1$array = array('a', 'b', 'c');
2foreach ($array as $letter=>$index) {
3
4 echo $letter; //Here $letter content is the actual index
5 echo $array[$letter]; // echoes the array value
6
7}//foreach
8
9