Jump to content


Photo

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


  • Please log in to reply
3 replies to this topic

#1 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 27 October 2006 - 02:41 PM

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.c...jects-in-PHP/1/
$dataSaver=&new DataSaver('This string will be saved to file');


thanks in advance.

#2 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 27 October 2006 - 07:26 PM

any takers?

#3 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 29 October 2006 - 02:23 PM

sorry to do this again but... bump.

#4 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 29 October 2006 - 03:51 PM

There is a difference (in PHP 4) and it's explained pretty well at this manual page:

http://us2.php.net/m....oop.newref.php






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users