From:             [EMAIL PROTECTED]
Operating system: MS Windows 98
PHP version:      4.0.6
PHP Bug Type:     Arrays related
Bug description:  array_unique works opposed to the manual

The manual (recent version from cvs) states that :

" array_unique() will keep the first key encountered for  every value, and
ignore all following keys. "

I've tested the two examples in this page and I've found
this statement is not true.

<?php
$input = array (4,"4","3",4,3,"3");
$result = array_unique ($input);
var_dump($result);
?>

output: /* PHP 4.0.6 Win'98 PWS */
array(2) {
  [3]=>
  int(4)
  [4]=>
  int(3)
}

but the manual says it should print:

array(2) {
   [0]=>
   int(4)
   [1]=>
   string(1) "3"
}

As you can recognize the latest keys are preserved
for both value 4 and 3.

-- 
Edit bug report at: http://bugs.php.net/?id=14805&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to