note 29974 added to function.end
| From: | ian at sytyarchives dot com | Date: | Mon, 03 Mar 2003 03:46:13 +0000 |
| Subject: | note 29974 added to function.end | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44754@lists.php.net to get a copy of this message | ||
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
}
--
http://www.php.net/manual/en/function.end.php
http://master.php.net/manage/user-notes.php?action=edit+29974
http://master.php.net/manage/user-notes.php?action=delete+29974
http://master.php.net/manage/user-notes.php?action=reject+29974