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:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 2:49 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to