note 48446 deleted from language.types.array by betz
| From: | betz@php.net | Date: | Tue, 18 Oct 2005 06:40:25 +0000 |
| Subject: | note 48446 deleted from language.types.array by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97144@lists.php.net to get a copy of this message | ||
Note Submitter: NOcom.gmail@yuuichiSPAM
----
I've been trying to create a multidimensional array with an arbitrary depth, but I've run
into a snag:
<?php
$array = Array();
$array[1][2][3] = "huzzah!";
$string = "[4][5][6]";
${"array" . $string} = "boo!";
$array{$string} = "hiss!";
?>
. . . outputs:
Array
(
[1] => Array
(
[2] => Array
(
[3] => huzzah!
)
)
[[4][5][6]] => hiss!
)
It seems that no matter what I do, I can't get PHP to treat the string as actual syntax. Has
anyone else had any luck with arbitrary-depth arrays? I'm not sure whether or not to call this
a bug, nor am I sure if it applies to PHP 5... I've only tested it in 4.3.10.