Re: array_seek function
| From: | Derick Rethans | Date: | Mon, 12 Apr 2010 08:20:57 +0000 |
| Subject: | Re: array_seek function | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47877@lists.php.net to get a copy of this message | ||
On Mon, 22 Mar 2010, Felix De Vliegher wrote:
> On 17-mrt-2010, at 19:09, Derick Rethans wrote:
>
> > On Wed, 17 Mar 2010, Felix De Vliegher wrote:
> >
> >> On 17-mrt-2010, at 17:52, Derick Rethans wrote:
> >>
> >>> On Wed, 17 Mar 2010, Felix De Vliegher wrote:
> >>>
> >>>> On 17-mrt-2010, at 17:27, Frederic Hardy wrote:
> >>>>>
> >>>>> Why not use arrayIterator::seek() ?
> >>>>
> >>>> Because the functionality isn't exactly the same.
> >>>> ArrayIterator::seek() only sets the array pointer, array_seek would
> >>>> also return the value + have fseek()-like functionality with the
> >>>> SEEK_* consts and optional negative offsets.
> >>>
> >>> To be honest, I'd rather have the proposed array_seek() return a status
> >>> whether the seek worked or not. Notices are uncool and you can already
> >>> retrieve data/key with key() and current().
> >>>
> >>
> >> Update:
> >> http://phpbenelux.eu/array_seek-return.patch.txt
> >> I've kept the fseek()-style return values (0 when fine, -1 when seek fails)
> >
> > Any reason why you picked that over the (IMO more logical) true/false
> > approach?
>
> No, it makes more sense to use the boolean return values, I was just
> using your fseek() analogy. Although I still find it useful to return
> the seeked value, and false when seek fails (basically how next(),
> reset() and friends behave).
Has this been added to trunk now? Or not yet?
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug