note 59204 added to language.references.return

From: Date: Tue, 29 Nov 2005 15:50:50 +0000
Subject: note 59204 added to language.references.return
Groups: php.notes 
Request: Send a blank email to php-notes+get-99295@lists.php.net to get a copy of this message
"Do not use return-by-reference to increase performance, the engine is smart enough to optimize this on its own. Only return references when you have a valid technical reason to do it!" Just to be clear about this (and correct me if I'm wrong), returning by reference is only necessary when returning a reference to something outside the function's local scope? For example, it is reasonable to return-by-reference a reference to a globally-scoped or object-scoped variable, but not to return a reference to a multi-megabyte array which only exists in the function's local scope, because PHP is smart enough to return the array by reference automatically to avoid unnecessary memory thrashing? ---- Manual Page -- http://www.php.net/manual/en/language.references.return.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59204 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59204&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59204&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59204&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59204&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59204&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59204&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59204&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59204&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99295) next »