#38313 [Csd->Bgs]: array_unique does not work
| From: | tony2001@php.net | Date: | Thu, 03 Aug 2006 12:31:57 +0000 |
| Subject: | #38313 [Csd->Bgs]: array_unique does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100275@lists.php.net to get a copy of this message | ||
ID: 38313
Updated by: tony2001@php.net
Reported By: philsci at firstbrand dot co dot jp
-Status: Closed
+Status: Bogus
Bug Type: Performance problem
Operating System: Windows XP Pro, Linux (redhat)
PHP Version: 5.1.4
Previous Comments:
------------------------------------------------------------------------
[2006-08-03 12:26:12] philsci at firstbrand dot co dot jp
this issue is resolved when we explode an array only with \r in Windows
and Linux, while \r\n nor \n work properly.
------------------------------------------------------------------------
[2006-08-03 12:23:49] tony2001@php.net
RTFM:
array_unique() takes input array and **returns a new array without
duplicate values**.
------------------------------------------------------------------------
[2006-08-03 12:19:47] philsci at firstbrand dot co dot jp
Description:
------------
$arr_list = array( 'philsci@firstbrand.co.jp',
'philsci@firstbrand.co.jp' );
print_r( $arr_list ); echo '<br />';
array_unique( $arr_list );
print_r( $arr_list ); echo '<br />';
---------------
shows:
Array ( [0] => philsci@firstbrand.co.jp [1] => philsci@firstbrand.co.jp
)
Array ( [0] => philsci@firstbrand.co.jp [1] => philsci@firstbrand.co.jp
)
so, array_unique does not work at all.
Expected result:
----------------
$arr_list = array( 'philsci@firstbrand.co.jp',
'philsci@firstbrand.co.jp' );
print_r( $arr_list ); echo '<br />';
array_unique( $arr_list );
print_r( $arr_list ); echo '<br />';
---------------
should be shown as:
Array ( [0] => philsci@firstbrand.co.jp [1] => philsci@firstbrand.co.jp
)
Array ( [0] => philsci@firstbrand.co.jp )
Actual result:
--------------
$arr_list = array( 'philsci@firstbrand.co.jp',
'philsci@firstbrand.co.jp' );
print_r( $arr_list ); echo '<br />';
array_unique( $arr_list );
print_r( $arr_list ); echo '<br />';
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38313&edit=1