|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-05 23:54 UTC] nlopess@php.net
[2004-07-07 16:33 UTC] vrana@php.net
[2017-05-26 22:43 UTC] 55953 dot kt at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 23:00:01 2025 UTC |
Description: ------------ Some translations (cz) of the documentation for array_values() gives an example of implementation of array_values for PHP 3 users. This is wrong. The correct example may be: <?php function array_values ($arr) { $t = array(); while (list($k, $v) = each ($arr)) { $t[] = $v; /* */ } /* */ return $t; } ?> Reproduce code: --------------- <?php function array_values ($arr) { $t = array(); while (list($k, $v) = each ($arr)) { $t[] = $v; return $t; } } var_dump (array_values (array ('a','b'))); ?> Expected result: ---------------- array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } Actual result: -------------- array(1) { [0]=> string(1) "a" }