note 10741 added to Passing by Reference
| From: | kluka at pobox dot sk | Date: | Fri, 19 Jan 2001 22:13:21 +0000 |
| Subject: | note 10741 added to Passing by Reference | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9979@lists.php.net to get a copy of this message | ||
It is possible (tested with PHP4.0.3pl1) to pass _a_ reference, which is not the same as passing
_by_ reference:
function inc($n) { $n++; }
$a = 1;
inc($a); print "$a\n"; //prints 1, of course
inc(&$a); print "$a\n"; // prints 2
http://www.php.net/manual/en/language.references.pass.php