How do I get the current index in a foreach loop?
foreach
foreach ($arr as $key => $val) { // How do I get the index? // How do I get the fir
$i = 0; foreach ($arr as $key => $val) { if ($i === 0) { // first index } // current index is $i $i++; }