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:30 PM, Felix De Vliegher
<felix.devlieg...@gmail.com> 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 
> that), and not the key of the item)
>
> Basically you can use it like this:
> $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
>
> I was wondering if it's useful to add this to the family of array functions. 
> I know there is a somewhat similar thing in SPL (ArrayIterator::seek), but 
> that doesn't work exactly like what I was aiming for.
>
> Attached is a patch for the function against the 5.3 branch. If approved, I 
> could add it to svn + testcases + docs. Feedback please :-)
>
>
> Kind regards,
> Felix
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to