|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2004-12-18 01:41 UTC] jed@php.net
  [2004-12-18 02:18 UTC] abajolet at toiletoine dot net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 07:00:01 2025 UTC | 
Description: ------------ Hello, between php 4.3.9 and php 4.3.10, foreach() changes its behavior (see code below). The ./configure and linked libraries are exactly the same in the two versions : './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/etc' '--with-ming' '--with-ldap' '--with-mysql' '--with-pgsql' '--with-gd' '--with-jpeg-dir=../jpeg-6b' '--with-png-dir=../libpng-1.2.2' '--with-freetype-dir=../freetype-2.1.7' '--with-t1lib' '--enable-bcmath' '--enable-calendar' '--enable-trans-sid' '--with-mcrypt' '--with-mhash' '--with-regex=php' '--with-zlib' '--enable-ftp' '--with-snmp' '--with-openssl=/usr/local/ssl' '--enable-sockets' '--enable-track-vars' '--enable-magic-quotes' '--enable-xslt' '--with-xslt-sablot' '--with-iconv=/usr/local' '--enable-sigchild' '--enable-inline-optimization' '--with-mm=/usr/local/mm' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-pcntl' Regards, Antoine Bajolet Reproduce code: --------------- <?php print phpversion() . '<br/>'; $array['foo'] = array('one'=>'two', 'three'=>'for'); $array['bar'] = array('five'=>'six', 'seven'=>'eight'); print_r($array); print '<br/>'; foreach ($array as $sub){ foreach($sub as $key => $value) { print $key . '=>' .$value .'<br/>'; } } ?> Expected result: ---------------- 4.3.9 Array ( [foo] => Array ( [one] => two [three] => for ) [bar] => Array ( [five] => six [seven] => eight ) ) one=>two three=>for five=>six seven=>eight Actual result: -------------- 4.3.10 Array ( [foo] => Array ( [one] => two [three] => for ) [bar] => Array ( [five] => six [seven] => eight ) ) 0=>Array 1=>foo 0=>Array 1=>bar