note 23594 added to function.array-pad
| From: | daarius@php.net | Date: | Tue, 23 Jul 2002 11:36:33 +0000 |
| Subject: | note 23594 added to function.array-pad | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33419@lists.php.net to get a copy of this message | ||
yes that is true. But, if the index of the array is 2=two, 3=three
and i want 4 more keys to be filled. But, not just filled anywhere, but i want to maintain the key
index.
so, i would like to have 0=FILLED, 1=FILLED ... 4=FILLED, 5=FILLED
now i got 4 more keys padded with my string.
We can do this "if" we know the missing keys, but if we dont, then it would be nice for
array_pad() or perhaps some new function to do this?
obviously we can achive this by looping through the array using array_key_exists(), and if you dont
find the key, simply create + fill it.
regards,
Daarius...
--
http://www.php.net/manual/en/function.array-pad.php
http://master.php.net/manage/user-notes.php?action=edit+23594
http://master.php.net/manage/user-notes.php?action=delete+23594
http://master.php.net/manage/user-notes.php?action=reject+23594