note 16699 deleted from function.array-push by jimw

From: Date: Sat, 10 Nov 2001 23:35:20 +0000
Subject: note 16699 deleted from function.array-push by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20712@lists.php.net to get a copy of this message
be carefull about this: function foo(&$bar) { global $arr; array_push($arr,$bar); $bar = "othervalue"; } function foo1(&$bar) { global $arr; array_push($arr,&$bar); // with '&'!!!!! $bar = "othervalue"; } ///////////////// $arr = array(); $bar = "something"; foo($bar); echo $bar; echo $arr[0]; //out: othervalue , something ///////////////// $arr = array(); $bar = "something"; foo1($bar); echo $bar; echo $arr[0]; //out: othervalue , othervalue

« previous php.notes (#20712) next »