note 55512 added to function.current

From: Date: Fri, 05 Aug 2005 13:18:51 +0000
Subject: note 55512 added to function.current
Groups: php.notes 
Request: Send a blank email to php-notes+get-93129@lists.php.net to get a copy of this message
By doing some small changes to the last post, one can make the function seek not just from the start in a forward manner but also from the end or from a relative position both forwards and backwards. E.g to seek backwards from a relative position one would supply 'current' as $start, and 'prev' as $iter. function array_set_current(&$array, $key, $start='reset', $iter='next'){ $start($array); while (current($array)!==FALSE){ if (key($array) == $key) { break; } $iter($array); } return current($array); } ---- Manual Page -- http://www.php.net/manual/en/function.current.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55512 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55512&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55512&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55512&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55512&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55512&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55512&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55512&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93129) next »