ID: 11541
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: Scripting Engine problem
Operating system: Linux Redhat 6.2
PHP Version: 4.0.4pl1
Description: weird behaviour with references and foreach

well, maybe this behaviour is not so weird as I tought...
the problem I had, was that the line taking the reference
and the foreach-statement were far apart, and I'd really
like to have localized variables in the foreach, like
foreach($arr as (my $val))...

Previous Comments:

[2001-06-18 14:20:23] [EMAIL PROTECTED]
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];

/* gives: Array ( [0] => a [1] => b ) */

foreach($arr as $ref);

/* gives: Array ( [0] => b [1] => b ) */


Full Bug description available at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to