RE: [PHP-DEV] array_init() opinions?

From: Date: Mon, 22 Oct 2001 21:35:22 +0000
Subject: RE: [PHP-DEV] array_init() opinions?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-68735@lists.php.net to get a copy of this message
Why not move the syntax to this? array_init( array/mixed indexes, mixed value[, int num]) So then I could do $a = array_init(array("key1", "key2", "key3"), "apple"); or $a = array_init(5, "apple", 6); -Chris -----Original Message----- From: Rasmus Lerdorf [mailto:rasmus@php.net] Sent: Monday, October 22, 2001 2:49 PM To: php-dev@lists.php.net Subject: [PHP-DEV] array_init() opinions? If you have been paying attention to php-cvs you will have noticed a little array_init() function I wrote yesterday. Fixed it up a bit today to make it much faster (with plenty of help). The syntax is: array_init(int start_index, int num, mixed value) That is, you tell it which index to start at, how many elements you want in the array and what the initialization value should be. $a = array_init(5,6,'banana'); would give you: $a[5] = "banana"; $a[6] = "banana"; $a[7] = "banana"; $a[8] = "banana"; $a[9] = "banana"; $a[10] = "banana"; Anybody see a better interface to a function like this? -Rasmus -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.dev (#68735) next »