Foreach php4.3 - mmcache 2.4.6
Brought to you by:
dstogov
marceloehernandez@hotmail.com
$sArr[0]="Aqui";
$sArr[1]="donde";
foreach ($sArr as $idar => $element) {
echo "<br>element $element";
}
not work correct.
On version php4.3.8-2.1 and mmcache 2.4.6 it's correct.
Please help!
Logged In: NO
I have also noticed this in php 4.3.10
Logged In: YES
user_id=1079679
This workes fine in eAccelerator, a fork of mmcache.
Logged In: YES
user_id=342496
I just finished emailing the following to
mmcache@turckware.ru, but the msg bounced.
Note that I've discovered the same bug, but... I also have a
work-around (Example #3 below).
-------------
The following code snippet works perfectly before compile.
After compile, Example #1 ceases to work.
<?php
$a = array( 5 => "Five", 10 => "Ten", 15 => "Fifteen" );
echo "Example 1:<BR>\n";
foreach( $a AS $key => $value ) echo "$key --> $value<BR>\n";
echo "<BR>Example 2:<BR>\n";
foreach( $a AS $value ) echo "$value<BR>\n";
echo "<BR>Example 3:<BR>\n";
reset( $a );
while( list( $key, $value ) = each( $a ) ) echo "$key -->
$value<BR>\n";
?>
I am using Debian Sarge with:
# php4 -v
PHP 4.3.10-15 (cli) (built: May 9 2005 08:54:56)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with Turck MMCache v2.4.6, Copyright (c) 2002-2003
TurckSoft, St. Petersburg, by Dmitry Stogov
This problem appears to be related to the "$key => $value"
syntax of the foreach() function.