note 23828 deleted from function.array by didou

From: Date: Thu, 17 Jun 2004 20:44:05 +0000
Subject: note 23828 deleted from function.array by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71259@lists.php.net to get a copy of this message
Note Submitter: cteubnerNOSPAM@NOSPAMncw-av.com ---- The function listed above for adding to the beginning of an array is thorougly unnecessary; use array_unshift() instead, which I guarantee is faster since PHP arrays aren't really arrays but instead are linked lists. This means that the thing that's unshifted needs only have its pointer set to point at the beginning of the array, and the array's pointer set to point at the new element. The example function above recopies every element in the array, which you need only do if you're working with contiguous storage, something PHP doesn't offer.

« previous php.notes (#71259) next »