PHP Version
4.0.1+
$array = [1, 2, 3, 1, 2, 4];
$unique_array = array_unique($array);

// Returns a new array while keeping the original input array unchanged
print_r($unique_array);
Output
array_unique(array $array, int $flags = SORT_STRING): array
$a = [0, 0];
$b = array_unique($a, SORT_STRING);

// Add a new element.
$b[] = 1;

print_r($b);

/* --------------------------------------------------
 * [Output Before PHP 7.2.0]
 *
 * Array
 * (
 *     [0] => 0
 *     [2] => 1  <-- The next numeric index is 2 due to the removed element.
 * )
 *
 * [Description]
 * Because duplicate elements were removed from the original array,
 * the removed element affected the numeric index sequence, causing the new
 * element to be added at index 2.
 * -------------------------------------------------- */

/* --------------------------------------------------
 * [Output Since PHP 7.2.0]
 *
 * Array
 * (
 *     [0] => 0
 *     [1] => 1  <-- The next numeric index is 1 because a new array is created.
 * )
 *
 * [Description]
 * Because the behavior was changed to create a new array by adding
 * only unique values, the new element is added at index 1.
 * -------------------------------------------------- */
$array = ['a', 'b', 'c', 'A', 'B', 'C'];
$unique_array = array_unique($array);

print_r($unique_array );
/*
    Array (
        [0] => a
        [1] => b
        [2] => c
        [3] => A
        [4] => B
        [5] => C
    )
*/
$array = [1, 2, 01, 03, '1', '2', '01', '02'];

/*
 * SORT_REGULAR
 * array_unique($array, SORT_REGULAR)
 *
 * [Description]
 * Compares elements without changing their data types (applies loose comparison ==).
 *
 * The integer 1 and the string '1' evaluate as equal values,
 * so the string '1' is removed as a duplicate.
 *
 * The strings '01' and '02' are also compared against numeric values,
 * so they are evaluated as equal to the integers 1 and 2, respectively,
 * and are removed as duplicates.
 */
$sort_regular = array_unique($array, SORT_REGULAR);

var_dump($sort_regular);

/*
	array(3) {
		[0]=> int(1)
		[1]=> int(2)
		[3]=> int(3)
	}
*/

/*
 * SORT_NUMERIC
 * array_unique($array, SORT_NUMERIC)
 *
 * [Description]
 * Compares elements after converting all values to numeric data types.
 *
 * The strings '01' and '02' are also converted to the numbers 1 and 2,
 * so they are removed as duplicates of the existing numbers 1 and 2.
 */
$sort_numeric = array_unique($array, SORT_NUMERIC);

var_dump($sort_numeric);

/*
	array(3) {
		[0]=> int(1)
		[1]=> int(2)
		[3]=> int(3)
	}
*/

/*
 * SORT_STRING
 * array_unique($array, SORT_STRING) - Default
 *
 * [Description]
 * Compares elements after converting all values to string data types.
 *
 * The integer 1 is converted to the string "1" and evaluates as equal
 * to the string '1', so it is removed as a duplicate.
 *
 * On the other hand, the string '01' is compared as "01" as-is,
 * so it is treated differently from "1" and preserved.
 */
$sort_string = array_unique($array, SORT_STRING);

var_dump($sort_string);

/*
	array(5) {
		[0]=> int(1)
		[1]=> int(2)
		[3]=> int(3)
		[6]=> string(2) "01"
		[7]=> string(2) "02"
	}
*/
$array = [
	'a' => 'green',
	'b' => 'green',
	'c' => 'orange'
];

$result = array_unique($array);

print_r($result);
/*
	Array (
		[a] => green
		[c] => orange
	)
*/
$array = [
    'a' => 'green',
    'red',
    'b' => 'green',
    'blue',
    'red'
];
$result = array_unique($array);

print_r($result);
/*
    Array (
        [a] => green
        [0] => red
        [1] => blue
    )
*/