minimi
26th May 2005, 17:13
I found a strange behaviour of foreach in PHP 4.3.11. For example, if you have the following code:
<?
$elements[0] = 'bla';
$elements[1] = 'blubb';
foreach($elements as $element){
print_r($element);
}
?>
it prints
Array
(
[0] => bla
[1] => 0
)
Array
(
[0] => blubb
[1] => 1
)
instead of the strings bla and blubb... Is this a bug in PHP 4.3.11?
<?
$elements[0] = 'bla';
$elements[1] = 'blubb';
foreach($elements as $element){
print_r($element);
}
?>
it prints
Array
(
[0] => bla
[1] => 0
)
Array
(
[0] => blubb
[1] => 1
)
instead of the strings bla and blubb... Is this a bug in PHP 4.3.11?