note 12861 deleted from function.array by irc-html

From: Date: Sat, 19 Jan 2002 20:54:18 +0000
Subject: note 12861 deleted from function.array by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25432@lists.php.net to get a copy of this message
[Editor's note: In PHP as in C (and many other languages) arrays are zero-based, not a problem if you did not read the information elsewhere in the manual, or are used to 1-based arrays like in awk or pascal] When using the explode function the first element in the array becomes $array[0]. Here is a little function that adds 1 to the keys through the entire array, so the first element is now $array[1] function addOneToIndex ($oldArray){ while (list ($index, $value) = each ($oldArray)){ $newArray [$index + 1] = $value; } return $newArray; }

« previous php.notes (#25432) next »