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
well since this is the first google hit for this problem:
function mb_tell(&$msg) { if(count($msg) == 0) { return 0; } //prev($msg); $kv = each($msg); if(!prev($msg)) { end($msg); print_r($kv); return ($kv[0]+1); } print_r($kv); return ($kv[0]); }