foreach
index? for
loop as follows:for ($i = 0; $i < 10; ++$i) {
echo $i . ' ';
}
$i
will give you the list. for
loop or is there some approach to get the index in the foreach
loop?
$index = 0;
foreach($data as $key=>$val) {
// Use $key as an index, or...
// ... manage the index this way..
echo "Index is $index\n";
$index++;
}