2010/4/15 Derick Rethans :
> On Tue, 13 Apr 2010, Felix De Vliegher wrote:
>
>> 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
On Tue, 13 Apr 2010, Felix De Vliegher wrote:
> 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
> >>> approac
On 12-apr-2010, at 10:20, Derick Rethans wrote:
> 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, Fel
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
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 arrayIterat
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, just to keep it similar to fseek(). Either way works for me.
I would expect
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 arrayIterat
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
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
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
On 17-mrt-2010, at 17:27, Frederic Hardy wrote:
>
> Hello Felix !
>
> Why not use arrayIterator::seek() ?
>
> Best regards,
> Fred
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 fu
> 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
2010/3/16 Felix De Vliegher :
Hi all
I recently needed seek functionality in arrays, and couldn't find it in the
regular set of array functions, so I wrote a function for it. (Seek = getting
an array value based on the position (or offset, if you want to call it like
that), and not the key of
On 17-mrt-2010, at 17:00, Patrick ALLAERT wrote:
> 2010/3/16 Felix De Vliegher :
>> Hi all
>>
>> I recently needed seek functionality in arrays, and couldn't find it in the
>> regular set of array functions, so I wrote a function for it. (Seek =
>> getting an array value based on the position (
2010/3/16 Felix De Vliegher :
> Hi all
>
> I recently needed seek functionality in arrays, and couldn't find it in the
> regular set of array functions, so I wrote a function for it. (Seek = getting
> an array value based on the position (or offset, if you want to call it like
> that), and not t
On Wed, Mar 17, 2010 at 04:07:36PM +0100, Pierre Joye wrote:
>
> Please double check what the patch does, test it, and think again
> about this question (hint: pos != key) :)
And once again, skimming emails (can you say ADD? I knew you could.)
bites me in the tush. :) I just looked at the first
On Wed, 17 Mar 2010, Daniel Convissor wrote:
> > $input = array(3, 'bar', 'baz');
> > echo array_seek($input, 2); // returns 'baz'
> > echo array_seek($input, 0); // returns 3
> > echo array_seek($input, 5); // returns NULL, emits an out of range warning
>
> Why waste time calling a function when
On Wed, Mar 17, 2010 at 4:02 PM, Daniel Convissor
wrote:
> Hi:
>
>> $input = array(3, 'bar', 'baz');
>> echo array_seek($input, 2); // returns 'baz'
>> echo array_seek($input, 0); // returns 3
>> echo array_seek($input, 5); // returns NULL, emits an out of range warning
>
> Why waste time calling
Hi:
> $input = array(3, 'bar', 'baz');
> echo array_seek($input, 2); // returns 'baz'
> echo array_seek($input, 0); // returns 3
> echo array_seek($input, 5); // returns NULL, emits an out of range warning
Why waste time calling a function when this can be done right now by
acting on the array i
Hi
As SEEK_END only makes sense with zero or negative offsets (for arrays anyway),
I've come up with an implementation for SEEK_END:
http://phpbenelux.eu/array_seek.patch.txt
So you can do:
$arr = array('a', 'b', 'c', 'd');
echo array_seek($arr, -2, SEEK_END); // outputs 'b'
echo array_seek($arr
> -Original Message-
> From: Felix De Vliegher [mailto:felix.devlieg...@gmail.com]
> Sent: 16 March 2010 13:31
> To: PHP internals
> Subject: [PHP-DEV] array_seek function
>
> Hi all
>
> I recently needed seek functionality in arrays, and couldn't
> find it in the regular set of arra
Right now, it returns the value of a given position.
How it's different from:
array_slice() returns the sequence of elements from the array array as
specified by the offset and length parameters?
array_slice returns an array of elements. This function would return the
value at the given posi
Hi!
Right now, it returns the value of a given position.
How it's different from:
array_slice() returns the sequence of elements from the array array as
specified by the offset and length parameters?
--
Stanislav Malyshev, Zend Software Architect
s...@zend.com http://www.zend.com/
(408
On Tue, Mar 16, 2010 at 4:22 PM, Derick Rethans wrote:
> I was also thinking, can we just make this work just like fseek (with a
> "whence" parameter) as well? (http://uk3.php.net/fseek)
Hi,
not sure how SEEK_END is supposed to work with arrays but here is
SEEK_SET and SEEK_CUR (with positive an
On Tue, 16 Mar 2010, Felix De Vliegher wrote:
> On 16-mrt-2010, at 17:07, Derick Rethans wrote:
>
> > On Tue, 16 Mar 2010, Felix De Vliegher wrote:
> >
> >> Right now, it returns the value of a given position. In that case,
> >> array_get_pos might be a better name. Oh, and I attached the patch
On 16-mrt-2010, at 17:07, Derick Rethans wrote:
> On Tue, 16 Mar 2010, Felix De Vliegher wrote:
>
>> Right now, it returns the value of a given position. In that case,
>> array_get_pos might be a better name. Oh, and I attached the patch
>> with .txt extension :)
>
> Does it also seek the arra
On Tue, 16 Mar 2010, Felix De Vliegher wrote:
> Right now, it returns the value of a given position. In that case,
> array_get_pos might be a better name. Oh, and I attached the patch
> with .txt extension :)
Does it also seek the array pointer? Because I think array_seek that
moves the pointe
On 16 March 2010 13:30, Felix De Vliegher wrote:
> Hi all
>
> I recently needed seek functionality in arrays, and couldn't find it in the
> regular set of array functions, so I wrote a function for it. (Seek = getting
> an array value based on the position (or offset, if you want to call it like
Hi Pierre
Right now, it returns the value of a given position. In that case,
array_get_pos might be a better name. Oh, and I attached the patch with .txt
extension :)
Greetings,
Felix
Index: ext/standard/array.c
===
--- ext/standa
hi Felix,
Not sure about the usefulness of this function but the name is
misleading (pls reattach the patch as .txt while being at it :). Does
it set the position (_seek) or does it return the value of a given
position (_get_pos)? or both (no idea :)?
Cheers,
Cheers,
On Tue, Mar 16, 2010 at 2:3
30 matches
Mail list logo