note 41438 deleted from language.references.pass by curt
| From: | curt@php.net | Date: | Mon, 05 Jul 2004 17:27:16 +0000 |
| Subject: | note 41438 deleted from language.references.pass by curt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72618@lists.php.net to get a copy of this message | ||
Note Submitter: Don@NOSPAM.DJMaus.us
----
If the parameter is not declared "BY REFERENCE" with an ampersand in the function
declaration, an ampersand on the parameter at the call has the same effect.
<?php
function foo($arg1, &$arg2)
{
print "foo($arg1, $arg2)\n";
$arg1++;
$arg2++;
}
$a = 11; $b = 22;
foo(&$a, $b);
print "after\t a=$a \t b=$b \n";
$c = 33; $d = 44;
foo($c, $d);
print "after\t c=$c \t d=$d \n";
?>
=============OUTPUT===
foo(11, 22)
after a=12 b=23
foo(33, 44)
after c=33 d=45