Article From:

PHPThe difference between a value transfer and a reference transfer. When is the value passed

(1)Value transfer: any change to the value within the function area will be ignored outside the function.

(2)Passing by reference: any changes to the value in the range of functions can also reflect these modifications outside the function.

(3)Advantages and disadvantages:

A:When the value is passed, the PHP must copy the value. Especially for large strings and objects, this will be a costly operation.

B.Passing by reference does not require duplicate values, which is good for performance improvement.







Leave a Reply

Your email address will not be published. Required fields are marked *