#33719 [Bgs]: foreach clash
| From: | s dot masugata at digicom dot dnp dot co dot jp | Date: | Sat, 16 Jul 2005 08:47:40 +0000 |
| Subject: | #33719 [Bgs]: foreach clash | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81921@lists.php.net to get a copy of this message | ||
ID: 33719
User updated by: s dot masugata at digicom dot dnp dot co dot jp
Reported By: s dot masugata at digicom dot dnp dot co dot jp
Status: Bogus
Bug Type: *General Issues
Operating System: Solaris8
PHP Version: 4.4.0
New Comment:
It is understood that the description is wrong.
PHP is a lazy language.
if will not to do fix, please manual add disclaimer.
Previous Comments:
------------------------------------------------------------------------
[2005-07-16 10:22:51] pajoye@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Use 2 different variables.
------------------------------------------------------------------------
[2005-07-16 05:11:44] s dot masugata at digicom dot dnp dot co dot jp
Description:
------------
KEY and VALUE of foreach are made the duplicate variable, strange
operation is
done.
Reproduce code:
---------------
<?php
$arr = array("1","123","12345");
foreach ( $arr as $val => $val ) {
// echo "debug {$val}\n";
// this comment is removed, stranger operation is done.
}
print_r( $arr );
?>
Expected result:
----------------
Array
(
[0] => 1
[1] => 123
[2] => 12345
)
Actual result:
--------------
Array
(
[0] => 1
[1] => 2
[2] =>
)
/usr/local/src/php-4.4.0/Zend/zend_execute.c(2436) : Freeing
0x0838B164 (12 bytes), script=f.php
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33719&edit=1