note 32222 deleted from language.references.pass by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 01:23:52 +0000 |
| Subject: | note 32222 deleted from language.references.pass by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57336@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I believe this is covered in the previous section: http://www.php.net/manual/en/language.references.arent.php.
The "$dest =& $src" command is re-aliasing the replace() function's private
$dest variable, which has no effect on the variable it was originally aliased to. There is no way
for a function to re-alias a variable passed in as its parameter (no clean way, anyway.) Just using
"=" is the correct syntax here, if your goal is to copy the global $src onto the global
$dest. Remember you're not really "passing in a reference", but "passing by
reference". A variable cannot "contain" a reference in PHP. References are
first-class (assignable) entities in Perl, just like pointers are in C, but not so with references
in PHP.