➤ The array_unique() function removes duplicate values from an array. If two or more array values are the same, the first appearance will be kept and the other will be removed. Syntax:
array_unique(array, sorttype)  // second parameter is optional
For instance:
$colours = [
	"Red",
	"Black", 
	"White",
	"Red",
	"Black",
	"Blue",
	"white"
	];
print_r (array_unique($colours));
// outputs: 
/*Array
(
    [0] => Red
    [1] => Black
    [2] => White
    [5] => Blue
    [6] => white
)*/
by Levani Makhareishvili
2 years ago
PHP
Arrays
Function
1
Pro tip: use ```triple backticks around text``` to write in code fences