Bug #12789 Updated: array_unique() always returns only 1 result for multi-dimentional arrays

From: Date: Thu, 24 Jan 2002 06:29:52 +0000
Subject: Bug #12789 Updated: array_unique() always returns only 1 result for multi-dimentional arrays
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77959@lists.php.net to get a copy of this message
ID: 12789 Comment by: james@ractive.ch Old Reported By: bystruev@yahoo.com Reported By: james@ractive.ch Status: Bogus Bug Type: Arrays related Operating System: Cobalt Linux PHP Version: 4.0.6 New Comment: I think you should mention that in the manual, esp. because array_unique worked with multi-dimensional arrays for versions < 4.0.6 I was wondering today why my search script did now work anymore until i saw that my host updated to 4.1.1... Previous Comments: ------------------------------------------------------------------------ [2001-09-14 19:42:39] jeroen@php.net Err: Array_unique/array_diff/array_intersect isn't supposed to handle multi-dimension _arrays_, nor objects. See also 10658 ------------------------------------------------------------------------ [2001-09-14 19:40:39] jeroen@php.net Array_unique isn't supposed to handle multi-dimension strings, nor objects. See also 10658 ------------------------------------------------------------------------ [2001-08-16 07:45:50] bystruev@yahoo.com array_unique() always returns only 1 result for multi-dimentional arrays Here is the code: $temp = Array ( Array('a', 'b'), Array('x', 'y'), ); print_r($temp); print_r(array_unique($temp)); Here is the result in PHP 4.0.4, as it should be, i.e. no array change: Array ( [0] => Array ( [0] => a [1] => b ) [1] => Array ( [0] => x [1] => y ) ) Array ( [0] => Array ( [0] => a [1] => b ) [1] => Array ( [0] => x [1] => y ) ) Here is the result in PHP 4.0.6: Array ( [0] => Array ( [0] => a [1] => b ) [1] => Array ( [0] => x [1] => y ) ) Array ( [0] => Array ( [0] => a [1] => b ) ) I have put the code at http://www.99servers.com/develop/test/array_unique.php, you can see the results by yourself. My phpinfo() is located at http://www.99servers.com/develop/test/phpinfo.php, just in case you need additional details about my php 4.0.6 configuration. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=12789&edit=1

« previous php.dev (#77959) next »