ID:               39541
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: all
 PHP Version:      5.2.0
 New Comment:

As a minor request, it would be handy if PHP had analogues for the
prev() and next() functions but which instead returned keys without
affecting the current array pointer.

Presently, one must use prev()/key() next()/key() and these both affect
the array pointer which is inconvenient when looping through an array
with the intention of comparing the current item to its immediate
neighbors.

With next_key() and prev_key() one could get the keys and then directly
lookup the neighboring items without affecting the current position
during looping.


Previous Comments:
------------------------------------------------------------------------

[2006-11-17 02:37:46] [EMAIL PROTECTED]

Description:
------------
It would be handy if PHP had functions to get the current and previous
keys in an array without affecting the current array pointer.
Presently, one must use prev()/key() next()/key() and these both affect
the array pointer. This is inconvenient when looping through an array
with the intention of comparing the current item to its immediate
neighbors. Having next_key() and prev_key() would allow one to directly
lookup the neighboring items without affecting the current position
while looping.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39541&edit=1

Reply via email to