Jump to content


This topic is now archived and is closed to further replies.


instantiating object with "&new ObjectName();"?

Recommended Posts

Only place I seen & referenced in code before is when you want to pass a variable into a function that you want to modify...

What does it mean in this different context, before the instantiation of an object?:
$var = &new ObjectName();

an example of where i see this is here although to me it seems like it is not needed just to create the object: http://www.devshed.com/c/a/PHP/The-Basics-of-Serializing-Objects-in-PHP/1/
$dataSaver=&new DataSaver('This string will be saved to file');

thanks in advance.

Share this post

Link to post
Share on other sites
There is a difference (in PHP 4) and it's explained pretty well at this manual page:


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.