Hi Peter,
with new() logically this doesn't make any difference because 
PHP is using the reference concept anyway.

$b = &anything

tells PHP to get hold of final effective "anything" and if it evaluates
to something referenceable: _not_ build a copy of it and then set 
variable "b" to reference it.
This is conceptual. If you want to know if &new() is 'cheaper'
than new() you might want to ask the developers list or take
a look at execution time for 10000 [&]new()s or so.

Thus 
$a = 1; $b = $a; $a = 2; echo $b;     // will show 1
because the value of $a is copied to form a new value
and then variable "b" is set to reference it.

//Whereas 
$a = 1; $b = &$a; $a = 2; echo $b;   // will show 2
because $a and $b reference the identical value instance.

$a = &any_constant;     // is forbidden 
because constants can not be referenced at all. You have
to ask PHP to do
$a = any_constant;
so it can form a value of the constant and then set $a to
reference it.

Hope this helps
-- 
Sven 

> -----Ursprüngliche Nachricht-----
> Von:  Peter Misun [SMTP:[EMAIL PROTECTED]
> Gesendet am:  Freitag, 6. Juni 2003 11:23
> An:   [EMAIL PROTECTED]
> Betreff:      [PHP-WIN] doing $mc=new myclass();  or  $mc= &new myclass();  ?
> 
>  << Datei: ATT00004.g95; charset = iso-8859-2 >>

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

Reply via email to