new keyword combined with other things...
| From: | Alexandru Patranescu | Date: | Tue, 07 Dec 2010 15:40:32 +0000 |
| Subject: | new keyword combined with other things... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-309892@lists.php.net to get a copy of this message | ||
In many other languages this will work:
*$result = new Object() -> method();*
But in php, it fails at parsing.
I've tried with parenthesis around new but nothing. Anyhow, as I saw later,
*new* operator has precedence over others so this couldn't be a solution.
I know a static function can be defined and the above statement can
transform into
*$result = Object::getNewInstance() -> method()*
but is there any way to write it directly? and if not, why isn't this
implemented yet and when will it be?
best regards,
Patranescu Alexandru