new keyword combined with other things.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
drealecs
Forum Newbie
Posts: 1
Joined: Mon Dec 06, 2010 9:20 am

new keyword combined with other things.

Post by drealecs »

how can this be write:

$result = new Object() -> method();

I've tried with parenthesis around new but nothing.
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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: new keyword combined with other things.

Post by AbraCadaver »

drealecs wrote:how can this be write:

$result = new Object() -> method();

I've tried with parenthesis around new but nothing.
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?
No. I don't know why, you can post on the php.internals mailing list.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply