note 29974 deleted from function.end by didou
| From: | didou@php.net | Date: | Mon, 18 Aug 2003 16:03:57 +0000 |
| Subject: | note 29974 deleted from function.end by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54601@lists.php.net to get a copy of this message | ||
Note Submitter: ian@sytyarchives.com
----
Im matching 5D arrays for a tree structure, and came upon a lacking function for php. Atleast I
couldnt find another method.
if you need to get out of each($array) loop , you cant use just end($array) because it will
repeatidly set the pointer to the last key. Using end($array) and next($array) dumps the pointer
past the end ending the each() next time it checks.
this particular function can be done other ways, but for example:
while($Clients = each($array)){
if($array[$Clients[key]][value] == "found value"){
end($array); // move pointer to last value
next($array); // move pointer past last value, killing the each
}
// do other stuff
}