Return Values Copied? Copied if By Reference?
| From: | Michael B Allen | Date: | Thu, 27 Jul 2006 02:29:31 +0000 |
| Subject: | Return Values Copied? Copied if By Reference? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-239835@lists.php.net to get a copy of this message | ||
Is a function return value copied? If the value is an integer I suppose
it is but what about a string or an array? If you pass by reference is
the return value still copied?
For example, is this:
function foo(&$arr) {
$arr[] = "bar";
}
faster than this?
function foo(&$arr) {
$arr[] = "bar";
return $arr; // is this copied?
}
I'm working on some code that would be called to generate a cell in a
possibly large table and therefore a small difference in performance
may have a significant impact.
Thanks,
Mike
--
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/