note 44636 added to function.array-fill
| From: | csst0266 at cs dot uoi dot gr | Date: | Wed, 11 Aug 2004 17:32:39 +0000 |
| Subject: | note 44636 added to function.array-fill | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74480@lists.php.net to get a copy of this message | ||
This is what I recently did to quickly create a two dimensional array (10x10), initialized to 0:
<?php
$a = array_fill(0, 10, array_fill(0, 10, 0));
?>
This should work for as many dimensions as you want, each time passing to array_fill() (as the 3rd
argument) another array_fill() function.
----
Manual Page -- http://www.php.net/manual/en/function.array-fill.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44636
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44636&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44636&report=yes
Search -- http://master.php.net/manage/user-notes.php