note 23828 added to function.array

From: Date: Mon, 29 Jul 2002 19:22:01 +0000
Subject: note 23828 added to function.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-33887@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.array.php http://master.php.net/manage/user-notes.php?action=edit+23828 http://master.php.net/manage/user-notes.php?action=delete+23828 http://master.php.net/manage/user-notes.php?action=reject+23828

« previous php.notes (#33887) next »