1<?php
2$fruits_list = array('Orange', 'Apple', ' Banana', 'Cherry', ' Banana');
3$result = array_unique($fruits_list);
4print_r($result);
5?>
6
7Output:
8
9Array ( [0] => Orange [1] => Apple [2] => Banana [3] => Cherry )
1<?php
2$input = array("a" => "green", "red", "b" => "green", "blue", "red");
3$result = array_unique($input);
4print_r($result);
5?>
6
7Array
8(
9 [a] => green
10 [0] => red
11 [1] => blue
12)