note 48446 added to language.types.array

From: Date: Fri, 24 Dec 2004 01:32:59 +0000
Subject: note 48446 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-82225@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/language.types.array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48446 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48446&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48446&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48446&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48446&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48446&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48446&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48446&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82225) next »