|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-12-16 14:37 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Jun 06 03:00:01 2026 UTC |
Description: ------------ foreach mechanism changed. foreach returns now the array not the key. This changed from 4.3.9 to 4.3.10 5.0.x retuns too as $key the sub arrays Reproduce code: --------------- <pre> <?php $demo_array = array('one', 'two', 'three'); print_r(array_keys($demo_array)); echo "\n\n"; foreach(array_keys($demo_array) as $key) { echo $key."<br>"; } ?> Expected result: ---------------- Array ( [0] => 0 [1] => 1 [2] => 2 ) 0 1 2 Actual result: -------------- Array ( [0] => 0 [1] => 1 [2] => 2 ) Array Array Array