> Hi Patrick
>
> That's of course possible, but that would only allow seeking to a relative
> position to where the array pointer is at that moment. The functionality also
> gets a bit ambiguous by adding an optional parameter. You're not going to the
> next or prev position of the array anymore.
You could always use reset() in combination with next($int). The main
benefit I see doing so is that you can do something like:
reset($array);
$jump = 3;
while ($elem = next($jump)) {
// Some treatment that needs to be done on every $jump element
}
Which would be slower and less readable with array_seek() of course,
depends on your use case!
> And I think functions like next, prev, current etc should be kept easy to
> use. If you want seek-like functionality, use the designated array function
> for that (if this one should make it into php, that is).
Well, it wouldn't be a mandatory option of course for BC. It would
jump forward/backward X elements just where X is 1 by default. It
could make sense to have both maybe?
Let's wait other's opinion.
Cheers,
Patrick
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php