|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-01-28 15:51 UTC] jbailey at raspberryginger dot com
Description:
------------
There is no way of doing $a->$b->a where I really want $a->($b->a)
Reproduce code:
---------------
class a {}
class b {}
$a = new a();
$b = new b();
$a->foo = "foo";
$a->bar = "bar";
$b->a = "foo";
$b->b = "bar";
$temp=$b->a;
echo $a->$temp;
echo $a->($b->a);
Expected result:
----------------
The lines:
echo $a->$temp;
echo $a->($b->a);
should each output the same thing.
Actual result:
--------------
Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in /tmp/test.php on line 18
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 21:00:01 2025 UTC |
echo $a->{$b->a}