#21920 [Fbk->Ver]: buggy example

From: Date: Tue, 28 Jan 2003 16:47:49 +0000
Subject: #21920 [Fbk->Ver]: buggy example
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969351382@lists.php.net to get a copy of this message
ID: 21920 Updated by: andrey@php.net Reported By: corinl@gmx.de -Status: Feedback +Status: Verified Bug Type: Documentation problem PHP Version: 4.3.0 New Comment: The docs : [snip] Note that keys are preserved. array_unique() sorts the values treated as string at first, then will keep the first key encountered for every value, and ignore all following keys. It does not mean that the key of the first related value from the unsorted array will be kept. [/snip] I get the users result on Windows(4.3.0-dev), RH 6.2(4.3.0-dev), Debian 3.0 (5.0.0-dev). The docs should be changed. Previous Comments: ------------------------------------------------------------------------ [2003-01-28 10:31:19] betz@php.net I get: php -v PHP 4.3.0 (cli) (built: Jan 8 2003 16:10:13) Copyright (c) 1997-2002 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies php test.php Array ( [a] => grün [0] => rot [1] => blau } Friedhelm ------------------------------------------------------------------------ [2003-01-28 10:26:38] corinl@gmx.de okay, so as you can the *keys* are different! ------------------------------------------------------------------------ [2003-01-28 10:14:05] andrey@php.net Yes, the output on my machine is this. I use the CLI binary. c:\apache\php>php-cli a_u.php Array ( [a] => gr?n [1] => blau [2] => rot ) c:\apache\php> Andrey ------------------------------------------------------------------------ [2003-01-28 10:08:33] corinl@gmx.de hi! yes, the ourput is correct...but the documentation is wrong, bacause it says the example should output: Array ( [b] => green [1] => blue [2] => red ) ------------------------------------------------------------------------ [2003-01-28 08:42:21] andrey@php.net Look at the View Source of your browser. Also when using CLI the output is as it is documented. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21920 -- Edit this bug report at http://bugs.php.net/?id=21920&edit=1

« previous php.doc (#969351382) next »