#29024 [Opn->Bgs]: array_values function documentation issue

From: Date: Mon, 05 Jul 2004 21:54:22 +0000
Subject: #29024 [Opn->Bgs]: array_values function documentation issue
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969361691@lists.php.net to get a copy of this message
ID: 29024 Updated by: nlopess@php.net Reported By: trosos at atlas dot cz -Status: Open +Status: Bogus Bug Type: Documentation problem PHP Version: Irrelevant New Comment: English docs are fine. The Czech translation team will update the file when they have some time. Thanks, Nuno Previous Comments: ------------------------------------------------------------------------ [2004-07-05 22:40:09] trosos at atlas dot cz 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" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29024&edit=1

« previous php.doc (#969361691) next »