Re: docs request

From: Date: Sat, 10 Nov 2001 20:14:12 +0000
Subject: Re: docs request
References: 1 2 3 4  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969338634@lists.php.net to get a copy of this message
At 07:02 PM 11/10/01 +0100, Hojtsy Gabor wrote:
Isn't
    array_chunk($array, 2, TRUE);
the same as
    array_slice($array, 0, 2);
OK, it is not completely the same, as you cannot choose "do not preserve keys" while using array_slice(). Wouldn't it be better to extend array_slice() with another parameter, or something like that... These functions seem to me nearly the same (except of key preservation).
No. array_chunk() will split the input array into several sub-arrays depending on the chunk length you specify. Try using array_chunk(array('a', 'b', 'c', 'd', 'e'), 2). -Andrei

« previous php.doc (#969338634) next »