Re: Re: does array_slice not work on multidimensional arrays?
| From: | Nisse Engström | Date: | Sat, 08 Aug 2009 16:36:09 +0000 |
| Subject: | Re: Re: does array_slice not work on multidimensional arrays? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296487@lists.php.net to get a copy of this message | ||
On Sat, 08 Aug 2009 16:05:20 +0100, Ashley Sheridan wrote:
> It is annoying working with arrays sometimes, as some functions work on
> the actual array, while others return the results of working on the
> array without changing anything. Is there any particular reason for
> that?
Well in this case [array_slice()], I'd say you most probably
want to keep the original array intact. In other cases,
such as sort() or array_push(), you really want to modify
the array you pass to them.
The implementors have probably tried to pick the most
reasonable method for each function, and it seems to work
out well for me. But I'm only guessing.
/Nisse