note 71769 deleted from ref.array by nlopess
| From: | nlopess@php.net | Date: | Sun, 17 Dec 2006 19:28:07 +0000 |
| Subject: | note 71769 deleted from ref.array by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120695@lists.php.net to get a copy of this message | ||
Note Submitter: xixona at voila dot fr
----
I just realised that my function did not work, with an array filled with booleans : next($tab) can
return false even if it is not the last...
This one works ... unless false is one of your keys. In this case I suggest using a counter and
sizeof($tab) as a condition for exiting the loop :
<?
function set(&$tab, $key){
reset($tab);
while ( ($key != key($tab)) && key($tab) ){next($tab);}
return current($tab);
}
?>