note 26226 added to function.array

From: Date: Wed, 23 Oct 2002 12:39:32 +0000
Subject: note 26226 added to function.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-38447@lists.php.net to get a copy of this message
In PHP 4.2.3 (and maybe earlier versions) arrays with numeric indexes may be initialized to start at a specific index and then automatically increment the index. This will save you having to write the index in front of every element for arrays that are not zero-based. The code: $a = array ( 21 => 1, 2, 3, ); print '<pre>'; print_r($a); print '</pre>'; will print: Array ( [21] => 1 [22] => 2 [23] => 3 ) -- http://www.php.net/manual/en/function.array.php http://master.php.net/manage/user-notes.php?action=edit+26226 http://master.php.net/manage/user-notes.php?action=delete+26226 http://master.php.net/manage/user-notes.php?action=reject+26226

« previous php.notes (#38447) next »