|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-12-15 13:47 UTC] andrei at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 09:00:01 2025 UTC |
array_walk() PHP4 won't reset() the array before walking, it will start at the current position instead of the first element as php3 does ? is this a bug or a feature ? if it is a feature, than the example in the documentation has to be changed ... <pre> $fruits=array("d"=>"lemon","a"=>"orange","b"=>"banana","c"=>"apple"); function test_alter( &$item1, $key, $prefix ) { $item1 = "$prefix: $item1"; } function test_print( $item2, $key ) { echo "$key. $item2<br>\n"; } array_walk( $fruits, 'test_print' ); array_walk( $fruits, 'test_alter', 'fruit' ); array_walk( $fruits, 'test_print' ); </pre> will need a 'reset($fruits);' before call #2 and #3 of array_walk to work