Edit report at https://bugs.php.net/bug.php?id=63020&edit=1
ID: 63020 Updated by: ahar...@php.net Reported by: p dot szymkowski at gmail dot com Summary: Dynamic functions & methods unification Status: Open Type: Feature/Change Request -Package: Documentation problem +Package: Scripting Engine problem Operating System: Any PHP Version: 5.4.6 Block user comment: N Private report: N New Comment: I'd be surprised if we didn't have bugs/requests for this already, but I can't find them at a glance, so let's leave this open in the right package. The AST RFC might be of interest here, since it would presumably provide a path towards fixing this: https://wiki.php.net/rfc/ast_based_parsing_compilation_process Previous Comments: ------------------------------------------------------------------------ [2012-09-05 20:21:07] p dot szymkowski at gmail dot com Description: ------------ This is more than a feature than a bug. Usage of '{}' is not unified at all. Why this syntax: $this->{'function'}; works, but: {'function'}(); doesn't? It's really confusing. In "test script" form i am giving you full example of it. Test script: --------------- <?php function myFunction(){}; // {'myFunction'}(); // doesn't work $str = 'myFunction'; $str(); // works class myClass { public $bar = 'myClass'; public $test = 'myClass'; public function foo() { } } // $class = new {'myClass'}(); // doesn't work $str = "myClass"; $class = new $str(); // works $class->{'foo'}(); // works // $class2 = new {$class->test}; // doesn't work $class2 = new $class->test(); // works Expected result: ---------------- syntax {'myFunction'}(); should work syntax $class = new {'myClass'}(); should work syntax $class2 = new {$class->test}; should work Actual result: -------------- only calling methods and getting properties of class works in that way. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63020&edit=1