note 114381 deleted from language.references.pass by googleguy
| From: | googleguy@php.net | Date: | Sun, 23 Feb 2014 17:24:39 +0000 |
| Subject: | note 114381 deleted from language.references.pass by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198614@lists.php.net to get a copy of this message | ||
Note Submitter: cs at mailinator dot com
----
Stating "Passing by reference" is a misnomer.
Objects are not passed by reference.
A correct statement would be Object references are passed by value.
As stated at http://www.php.net/manual/en/language.oop5.references.php
A simple "litmus test":
swap( &$arg1, &$arg2) {
$temp = $arg1;
$arg1 = $arg2;
$arg2 = $temp;
}
$var1 = ...;
$var2 = ...;
swap($var1,$var2);
Does calling swap actually cause these to be changed?
If not it isn't Pass-by-reference.
Concept care of JavaDude.com -- Scott Stanchfield