×
Jinxia Li

Is return-by-reference in PHP more efficient than the return statement to return a value in JavaScript?

No Comments

My guess:

In the use case of returning a value/reference from a function, I do feel return-by-reference in PHP is more efficient than return a value in JavaScript. When we want to use the reference that a PHP function returned, we just need to bound a variable to it, which is faster compare to that in JavaScript we have to make a copy of the returned value to use it.

Reference

In PHP (>=5.0), is passing by reference faster?

https://stackoverflow.com/questions/178328/in-php-5-0-is-passing-by-reference-faster

PHP lazy copy or copy on write

http://web.archive.org/web/20130406174901/http://www.thedeveloperday.com/php-lazy-copy/

Leave a Comment

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

By commenting you accept the Privacy Policy