Assigning the return value of new by referenceis deprecated

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
divyac11
Forum Newbie
Posts: 1
Joined: Sat Nov 14, 2009 12:01 pm

Assigning the return value of new by referenceis deprecated

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Assigning the return value of new by referenceis deprecated

Post by requinix »

Code: Select all

$foo =& new bar();
Remove the &s.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Assigning the return value of new by referenceis deprecated

Post 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.
Post Reply