I’ve used both methods quite a bit but I recently wondered why I hadn’t standardized on one or the other, or if there was a best practice and what the reasons behind it are. While the returning references page at PHP states quite clearly, with respect to returning references: Only return references when you have a valid technical reason to
Tag: pass-by-value
Are PHP Variables passed by value or by reference?
Are PHP variables passed by value or by reference? Answer It’s by value according to the PHP Documentation. By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the function). To allow a function to modify its arguments, they must be passed