diff --git a/functions/array.xml b/functions/array.xml
index 996848db5b..992a3b5c8b 100644
--- a/functions/array.xml
+++ b/functions/array.xml
@@ -1378,7 +1378,11 @@ echo "sum(b) = ".array_sum($b)."\n";
array_unique takes input
array and returns a new array
without duplicate values.
- Note that keys are preserved.
+
+
+ Note that keys are preserved. array_unique will
+ keep the first key encountered for every value, and ignore all
+ following keys.
@@ -1386,12 +1390,40 @@ echo "sum(b) = ".array_sum($b)."\n";
$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique ($input);
+print_r($result);
+// this will output :
+//Array
+//(
+// [a] => green
+// [0] => red
+// [1] => blue
+//)
- This makes $result have array ("a" =>
- "green", "red", "blue");.
+ Note that array_unique take into account
+ value's type. This is usually of no matter, except when it
+ comes to compare numbers, which can be of several types.
+ This may lead to confusing results.
+
+
+
+ array_unique and types
+
+$input = array (4,"3",3,"4",4,4);
+$result = array_unique ($input);
+print_r($result);
+// this will output :
+//Array
+//(
+// [0] => 3
+// [1] => 3
+// [2] => 4
+// [3] => 4
+//)
+
+