01-21-2008, 01:01 PM
|
#8 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Quote:
|
$some_obj =& new TestClass(); would leave you with a fatal error and nothing more
|
are you sure? this was standard procedure in php4, because the php4 object model didnt pass objects by ref, it made a copy, thus
PHP Code:
$pObj = new lolItsAClass();
means that there is a copy of the object being made, so to combat we have to tell the php interpreter that we want the reference and not the copy:
PHP Code:
$pObj =& new lolItsAClass();
in php5 this was updated so that the 'new' keyword automatically returned a reference to the newly created object and not a copy, hence the need for the 'clone' keyword (to replicate objects), i cant test my thorey because im at work.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|