#41324 [Fbk->Csd]: array_unique problem

From: Date: Tue, 08 May 2007 11:30:33 +0000
Subject: #41324 [Fbk->Csd]: array_unique problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112394@lists.php.net to get a copy of this message
ID: 41324 User updated by: kami dot fubuki at gmail dot com Reported By: kami dot fubuki at gmail dot com -Status: Feedback +Status: Closed Bug Type: Unknown/Other Function Operating System: windows xp PHP Version: 5.2.2 New Comment: Thanks! I've dumped the variables (var_dump();) and it seems that there was a trailing newline (because of fscanf) from the windows vs *nix formatting. It seems that print_r didn't append this newline character into the formatting. Previous Comments: ------------------------------------------------------------------------ [2007-05-08 09:19:16] judas dot iscariote at gmail dot com works for me.. <?php $unique_terms = array('a', 'c', 'd', 'b', 'c', 'b', 'c', 'd', 'b', 'c', 'd'); print_r($unique_terms); $unique_terms= array_unique($unique_terms); print_r($unique_terms);exit; Array ( [0] => a [1] => c [2] => d [3] => b [4] => c [5] => b [6] => c [7] => d [8] => b [9] => c [10] => d ) Array ( [0] => a [1] => c [2] => d [3] => b ) are you using any kind of zend_extension ? are you sure the "conflicting 'c'" does not have spaces or other chars inside ? ------------------------------------------------------------------------ [2007-05-08 09:16:46] tony2001@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2007-05-08 08:43:03] kami dot fubuki at gmail dot com Description: ------------ array_unique doesn't seem to work correctly. Reproduce code: --------------- print_r($unique_terms); $unique_terms=array_unique($unique_terms); print_r($unique_terms);exit; Expected result: ---------------- Array ( [0] => a [1] => c [2] => d [3] => b [4] => c [5] => b [6] => c [7] => d [8] => b [9] => c [10] => d ) Array ( [0] => a [1] => c [2] => d [3] => b ) Actual result: -------------- Array ( [0] => a [1] => c [2] => d [3] => b [4] => c [5] => b [6] => c [7] => d [8] => b [9] => c [10] => d ) Array ( [0] => a [1] => c [2] => d [3] => b [4] => c ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41324&edit=1

« previous php.bugs (#112394) next »