#46606 [Opn->Bgs]: Returning by Reference Increases Performance

From: Date: Fri, 28 Nov 2008 23:03:18 +0000
Subject: #46606 [Opn->Bgs]: Returning by Reference Increases Performance
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1564@lists.php.net to get a copy of this message
ID: 46606 Updated by: danbrown@php.net Reported By: php at info-svc dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Linux PHP Version: Irrelevant New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2008-11-18 22:36:01] php at info-svc dot com Description: ------------ I'm reporting a documentation comment that was rejected but should be valid. note 87076 rejected and deleted from language.references.return by notes editor danbrown ----- Copy of your note below ----- "Do not use return-by-reference to increase performance" This is not accurate. If you want PHP to return a string that was passed-by-reference without making a copy of it then you must also return-by-reference to increase performance. Robert Chapin Chapin Information Services Reproduce code: --------------- $a = 'world'; $b = escape($a); $b .= '3'; echo $a; function escape(&$hello) { $hello .= '2'; return $hello; } Expected result: ---------------- world23 Actual result: -------------- world2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46606&edit=1

« previous php.doc.bugs (#1564) next »