Array_unique () removes repeated values from the array [function] This function returns a new array with no repeated values based on the specified array, the key name remains unchanged. this function first sorts the values as strings, then retains only the first key name encountered for each value, and then ignores all subsequent key names... syntaxHighlighter. all ();
Array_unique () removes repeated values from the array
[Function]
This function returns a new array with no repeated values based on the specified array, and the key name remains unchanged.
This function first sorts values as strings, and then retains only the first key name for each value,
Then, ignore all the key names
This does not mean that the first key name that appears with the same value in the unordered array is retained.
Scope of use]
Php4> = 4.0.1, php5.
[Use]
Mixed array_unique (array)
Array/required/the original array to be processed by the function
[Example]
[Php]
$ Input = array ('C' => "green", 'AED', 'B' => 'green', 'Blue ', 'bed ');
Var_dump (array_unique ($ input ));
/*
Array (4 ){
["C"] =>
String (5) "green"
[0] =>
String (3) "aed"
[1] =>
String (4) "blue"
[2] =>
String (3) "bed"
}
*/
Taken from zuodefeng's note