ID: 31126
Updated by: [EMAIL PROTECTED]
Reported By: rf at inmacom dot de
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 4.3.10
New Comment:
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader. These extensions often modify engine
behavior which is not related to PHP itself.
.
Previous Comments:
------------------------------------------------------------------------
[2004-12-16 16:57:43] rf at inmacom dot de
Description:
------------
Foreach gives an array instead of the value for each element of an
array.
Reproduce code:
---------------
<?
$a = array( "21","22","23","24","25" );
var_dump( $a );
echo "<hr />";
foreach( $a as $v ) {
var_dump( $v );
echo "<hr />";
}
?>
Expected result:
----------------
array(5) {
[0]=>
string(2) "21"
[1]=>
string(2) "22"
[2]=>
string(2) "23"
[3]=>
string(2) "24"
[4]=>
string(2) "25"
}
<hr />string(2) "21"
<hr />string(2) "22"
<hr />string(2) "23"
<hr />string(2) "24"
<hr />string(2) "25"
<hr />
Actual result:
--------------
array(5) {
[0]=>
string(2) "21"
[1]=>
string(2) "22"
[2]=>
string(2) "23"
[3]=>
string(2) "24"
[4]=>
string(2) "25"
}
<hr />array(2) {
[0]=>
string(2) "21"
[1]=>
int(0)
}
<hr />array(2) {
[0]=>
string(2) "22"
[1]=>
int(1)
}
<hr />array(2) {
[0]=>
string(2) "23"
[1]=>
int(2)
}
<hr />array(2) {
[0]=>
string(2) "24"
[1]=>
int(3)
}
<hr />array(2) {
[0]=>
string(2) "25"
[1]=>
int(4)
}
<hr />
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31126&edit=1