|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-09-01 13:56 UTC] nathan at cjhunter dot com
When accessing a class array variable member from within a double quoted string it is not interpreted correctly. This is certainly not a critical bug but it would "user friendly" to the developere implement such a thing.
Example..
<?
class a {
var $var = array("key" => "value");
}
$inst = a();
echo "$a->var[key]";
?>
Gives us 'Array[key]' instead of what I would expect, which would be 'value'.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 10 16:00:02 2026 UTC |
You should use one of the following: echo $a->var["key"] or echo "{$a->var[key]}" BTW, the script you gave cannot work because it should be "new a();" and your variable is named "inst" not "a".