$obj = new orderModel();$obj = new &orderModel();
I know that & is to get the meaning of the reference, in the work is generally for the function, but I do not understand, so to instantiate a class when the add address character what is the meaning? Do you have any friends to write a demo out, detailed instructions under these two formulations in those circumstances will have different effects? Thank you
Reply content:
$obj = new orderModel();$obj = new &orderModel();
I know that & is to get the meaning of the reference, in the work is generally for the function, but I do not understand, so to instantiate a class when the add address character what is the meaning? Do you have any friends to write a demo out, detailed instructions under these two formulations in those circumstances will have different effects? Thank you
The second way is no longer necessary.
Since PHP 5, new automatically returns references, so using =& here is obsolete and generates E_STRICT-level messages.
new orderModel()
a direct return is a reference to an object