Page 1 of 1

Assigning the return value of new by referenceis deprecated

Posted: Sat Nov 14, 2009 12:09 pm
by divyac11
I am using WampServer 2.0i which includes

- Apache 2.2.11
- MySQL 5.1.36
- PHP 5.3.0

while running the page it shows somethings like
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\wirelesscomplete\sections\catalog\products\add.php on line 10


Please help me to fix this

Re: Assigning the return value of new by referenceis deprecated

Posted: Sat Nov 14, 2009 2:13 pm
by requinix

Code: Select all

$foo =& new bar();
Remove the &s.

Re: Assigning the return value of new by referenceis deprecated

Posted: Sat Nov 14, 2009 6:25 pm
by John Cartwright
To explain a bit further, in PHP5, objects are passed by reference by default (whereas PHP4 passes by value by default). Therefore, as tasairis pointed out, they are not needed.