array_init() opinions?
| From: | Rasmus Lerdorf | Date: | Mon, 22 Oct 2001 20:49:29 +0000 |
| Subject: | array_init() opinions? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-68731@lists.php.net to get a copy of this message | ||
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