Code Comments
Programming Forum and web based access to our favorite programming groups.Hello all,
My provider upgraded from php version 4.3.x to 4.3.10. And I found out the
foreach construct is working different
When using as follows:
foreach($any_array as $item){
print_r($item)
}
$item is an array!!! The output is as follows:
array (
[0]=>'the value of the current array item'
[1]=>'the index of the current array item'
)
When using
foreach($any_array as $index->$item){
print_r($item);
}
it is working as expected printing the value of the array entry.
Is this a bug?
If not did I miss something?
See also the last note in
http://www.php.net/manual/nl/contro...res.foreach.php)
ROB
Post Follow-up to this message> foreach($any_array as $item){
> print_r($item)
> }
Are you sure that it's "foreach" fault? Try "print_r( $any_array )"
before "foreach".
I do not have this effect in PHP 4.3.9.
Hilarion
Post Follow-up to this message
"Rob" <reply_@news_group.please> schreef in bericht
news:e_Byd.144636$lN.87412@amsnews05.chello.com...
> Hello all,
>
>
> My provider upgraded from php version 4.3.x to 4.3.10. And I found out the
> foreach construct is working different
> When using as follows:
>
> foreach($any_array as $item){
> print_r($item)
> }
>
> $item is an array!!! The output is as follows:
>
> array (
> [0]=>'the value of the current array item'
> [1]=>'the index of the current array item'
> )
>
> When using
>
> foreach($any_array as $index->$item){
> print_r($item);
> }
> it is working as expected printing the value of the array entry.
>
> Is this a bug?
> If not did I miss something?
>
> See also the last note in
> http://www.php.net/manual/nl/contro...res.foreach.php)
>
>
> ROB
>
>
It is solved.
The Zend Optimizer version 2.5.5 (version number according to my provider)
is causing the problem. When this is upgraded all works.
(See also the last note in
http://www.php.net/manual/nl/contro...res.foreach.php)
ROB
Post Follow-up to this message> foreach($any_array as $item){
> print_r($item)
> }
Are you sure that it's "foreach" fault? Try "print_r( $any_array )"
before "foreach".
I do not have this effect in PHP 4.3.9.
Hilarion
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.