note 41438 added to language.references.pass

From: Date: Fri, 09 Apr 2004 22:50:15 +0000
Subject: note 41438 added to language.references.pass
Groups: php.notes 
Request: Send a blank email to php-notes+get-67930@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/language.references.pass.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41438 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41438&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41438&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67930) next »