Date: 12/15/99
- Next message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #2980 Updated: array_walk behaves different than in php3"
- Previous message: Andrei Zmievski: "Re: [PHP-DEV] variable initialization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: hholzgra <email protected>
Operating system:
PHP version: 4.0 Latest CVS (15/12/1999)
PHP Bug Type: Misbehaving function
Bug description: array_walk behaves different than in php3
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
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #2980 Updated: array_walk behaves different than in php3"
- Previous message: Andrei Zmievski: "Re: [PHP-DEV] variable initialization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

