It all depends on what you want to do.

The first syntax creates a copy of the object, since it calls "new" by value
The second creates a "link" since it uses "&" before "new", thus calling it
"by reference".

In the first form, you have a copy, that you can use leaving the original
object intact.
In the second, you don't

----- Original Message -----
From: "Peter Misun" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Per Lundberg" <[EMAIL PROTECTED]>
Sent: Friday, June 06, 2003 1:17 PM
Subject: Re: [PHP-WIN] doing $mc=new myclass(); or $mc= &new myclass(); ?



but I couldn't find case, in which is better to use the first form

why should I have copy, if there is an original where I'm not having control
over it ?!?

5o


Per Lundberg wrote:

> On Fri, 2003-06-06 at 11:23, Peter Misun wrote:
> > need help:
> > what do you suggest to use:
> >
> >   $mc = new myclass();
> > or
> >   $mc = &new myclass();
>
> The first form will copy the object.  If you don't want this, use the
> second form.
> --
> Best regards,
>
> Per Lundberg / Capio ApS
> Phone: +46-18-4186040
> Fax: +46-18-4186049
> Web: http://www.nobolt.com
>
>                                                   ------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------------------------------------
>                        Name: signature.asc
>    signature.asc       Type: application/pgp-signature
>                    Encoding: 7bit
>                 Description: This is a digitally signed message part

--

Mgr. Peter Misun
MicroStep-MIS, Ilkovicova 3, 841 04 Bratislava, Slovakia
tel: +421/ 2/ 602 00 127, 111,  fax: +421/ 2/ 602 00 180



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to