Home > Article > Backend Development > PHP errorDeprecated: Assigning the return value of new_PHP tutorial
After upgrading php to php5.3 today, when using =&, the PHP error Deprecated: Assigning the return value of new by reference is deprecated in appears. After searching for some information, I found out that php5.3 does not support =&. .
Deprecated: Assigning the return value of new by reference is deprecated in solution:
Error line: $mysql =& new mysql;
Cause of error: After php5.3 started, the "=&" symbol in php was abolished
Solution:
1. If you want to copy, just use = to quote. The details are as follows: 1. PHP5 object copying uses reference;
2. If you do not use the reference method, you need to add the keyword clone;
when copying the object
3. If you want to change some attributes during the copying process, add the function _clone();