From: nickj-phpbugs at nickj dot org
Operating system: *
PHP version: 5CVS-2005-08-23 (snap)
PHP Bug Type: Feature/Change Request
Bug description: Requesting array_unique() function that works with
multi-dimensional arrays.
Description:
------------
Requesting array_unique() function to work correctly with
multi-dimensional arrays (or a new function that does the same thing, so
as to retain backwards compatibility)
Script:
===================================================
<?php
$array = array (1 => array(1, 2, 3),
2 => array(1, 2),
3 => array(1, 3, 4),
4 => array(1, 2),
5 => array(1, 3, 4)
);
$array = array_unique ($array);
print_r ($array);
?>
===================================================
Current actual output:
===================================================
ludo:~/tmp/php-5.1-dev/array_unique# ../../php5-200507102230/sapi/cli/php
./test.php
Array
(
[1] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
ludo:~/tmp/php-5.1-dev/array_unique#
===================================================
Desired output:
===================================================
ludo:~/tmp/php-5.1-dev/array_unique# ../../php5-200507102230/sapi/cli/php
./test.php
Array
(
[1] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
[4] => Array
(
[0] => 1
[1] => 2
)
[5] => Array
(
[0] => 1
[1] => 3
[2] => 4
)
)
ludo:~/tmp/php-5.1-dev/array_unique#
===================================================
Note the order of the keys isn't a big concern to me, although others may
be concerned about this.
Various bogus bugs that people have logged when the encountering this
behaviour:
Bug #16715, Bug #12690, Bug #13403, Bug #10891, Bug #12789, Bug #12528
I couldn't see a feature request for this though, so that's what this is.
--
Edit bug report at http://bugs.php.net/?id=34217&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34217&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34217&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34217&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34217&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34217&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34217&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34217&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34217&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34217&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34217&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34217&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34217&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34217&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34217&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34217&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34217&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34217&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34217&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34217&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34217&r=mysqlcfg