Re: Re: does array_slice not work on multidimensional arrays?
| From: | Ashley Sheridan | Date: | Sat, 08 Aug 2009 16:21:09 +0000 |
| Subject: | Re: Re: does array_slice not work on multidimensional arrays? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296486@lists.php.net to get a copy of this message | ||
On Sat, 2009-08-08 at 12:18 -0400, Robert Cummings wrote:
> John Butler 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?
> >
> > ...you mean what are the reasons for the different ways the arrays work?
> >
> > Then you must be asking the list in general (not me ;-))
>
> Efficiency is often one of the reasons. Do you really want the overhead
> incurred by returning a copy of a 50000 member. Most of the sort
> functions work on the array itself.
>
> By working on the array itself, PHP offers you, the programmer, the
> choice of incurring the overhead since you can copy it before sorting.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
That makes sense.
Thanks,
Ash
http://www.ashleysheridan.co.uk