¿Cómo obtengo el índice actual en un bucle foreach
?¿Cómo puedo obtener el índice de matriz actual en un bucle foreach?
foreach ($arr as $key => $val)
{
// How do I get the index?
// How do I get the first element in an associative array?
}
'$ key' ES el índice actual. – jason