note 74357 deleted from language.variables by bjori
| From: | bjori@php.net | Date: | Sat, 07 Apr 2007 15:27:18 +0000 |
| Subject: | note 74357 deleted from language.variables by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125172@lists.php.net to get a copy of this message | ||
Note Submitter: zaitsman at mail dot ru
Reason: I dont think this syntax is documented but the other is documented pretty well
----
Spent about an hour figuring this out - if you have an array and wanna get to its content using
another variable as its cell name you should do like this:
<?php
$_SAMPLE_ARRAY['something_1']=123;
$_SAMPLE_ARRAY['something_2']=321;
$id=1;
echo $_SAMPLE_ARRAY{"something_".$id};
//will output 123
?>