note 47843 deleted from function.current by bjori
| From: | bjori@php.net | Date: | Mon, 24 Apr 2006 15:12:16 +0000 |
| Subject: | note 47843 deleted from function.current by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109451@lists.php.net to get a copy of this message | ||
Note Submitter: jari dot eskelinen at iki dot fi
----
mattblisset's array_set_current has one flaw: if you have array with key 0, while-loop will
stop there. Fixed version:
function array_set_current(&$array, $key){
reset($array);
while (current($array)!==FALSE){
if (key($array) == $key) {
break;
}
next($array);
}
return current($array);
}