Bug #11541 Updated: weird behaviour with references and foreach
| From: | andre@php.net | Date: | Tue, 19 Jun 2001 02:18:33 +0000 |
| Subject: | Bug #11541 Updated: weird behaviour with references and foreach | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57044@lists.php.net to get a copy of this message | ||
ID: 11541
Updated by: andre
Reported By: jens.dreger@physik.fu-berlin.de
Old-Status: Open
Status: Bogus
Bug Type: Feature/Change Request
Operating system:
PHP Version: 4.0.4pl1
Assigned To:
Comments:
no bug, closing
ps. this is PHP there won't be local variables like the ones you proposed in the near future I
guess
Previous Comments:
---------------------------------------------------------------------------
[2001-06-18 14:29:54] jens.dreger@physik.fu-berlin.de
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))...
---------------------------------------------------------------------------
[2001-06-18 14:20:23] jens.dreger@physik.fu-berlin.de
<?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 ) */
?>
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=11541&edit=2