Re: substr/array_slice in []
| From: | Alexey Zakhlestin | Date: | Tue, 02 Oct 2007 12:35:43 +0000 |
| Subject: | Re: substr/array_slice in [] | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32542@lists.php.net to get a copy of this message | ||
On 10/1/07, Martin Alterisio <malterisio777@gmail.com> wrote:
> Sorry to bother, I have a few questions on this matter.
> How will this impact on the SPL ArrayAccess and related interfaces and
> objects?
> Will there be an interface to this functionality?
> If so, how will ranges be passed through to this interface?
> Will this be consistent with substr() and array_slice() if used with an
> ArrayAccess implementation?
I guess it can be made to work with current ArrayAccess, but result
will be quite slow. (it will need to query requested elements
one-by-one and recombine those in array)
But adding another interface can solve the problem. Ranges can be
passed exactly the way they are passed to [] operator
public function rangeGet($start, $length);
public function rangeSet($start, $length, array $data);
--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/