note 32222 added to language.references.pass

From: Date: Tue, 20 May 2003 22:06:38 +0000
Subject: note 32222 added to language.references.pass
Groups: php.notes 
Request: Send a blank email to php-notes+get-48690@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/language.references.pass.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32222 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32222&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32222&report=yes

« previous php.notes (#48690) next »