Bug #11541: weird behaviour with references and foreach

From: Date: Mon, 18 Jun 2001 18:20:23 +0000
Subject: Bug #11541: weird behaviour with references and foreach
Groups: php.dev 
Request: Send a blank email to php-dev+get-56803@lists.php.net to get a copy of this message
From: jens.dreger@physik.fu-berlin.de Operating system: Linux Redhat 6.2 PHP version: 4.0.4pl1 PHP Bug Type: Scripting Engine problem Bug description: weird behaviour with references and foreach <?php echo "<small><pre>"; /* for some reason the following code magically kills an array value, or better, overwrites it with another one. might be related to bug #6417 */ $arr = array('a','b'); $ref =& $arr[0]; print_r($arr); /* gives: Array ( [0] => a [1] => b ) */ foreach($arr as $ref); print_r($arr); /* gives: Array ( [0] => b [1] => b ) */ ?> -- Edit Bug report at: http://bugs.php.net/?id=11541&edit=1

« previous php.dev (#56803) next »