array_unique
array_unique — Removes duplicate values from an array.Description
array_unique( array $array,Takes an input array and returns a new array without duplicate values. Note that keys are preserved. If multiple elements compare equal under the given flags, then the key and value of the first equal element will be retained.
int $flags = SORT_STRING ): array
Note:Two elements are considered equal if and only if (string) $elem1 === (string) $elem2 i.e. when the string representation is the same, the first element will be used.
Parameters
Return Values
Returns the filtered array.More information about array_unique on official PHP documentation site
array_unique - Popular snippets
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode print_r array_unique
last run:
2023-11-01 17:43:41
12
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode print_r array_unique
last run:
2023-11-08 17:10:39
8
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode array_unique print_r
last run:
2023-10-27 16:46:56
8
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode array_unique print_r
last run:
2023-11-01 17:56:02
7
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode array_unique print_r
last run:
2023-10-25 17:06:46
7
- PHP 8.0 / MySQL 8.0 array_unique explode implode
last run:
2025-04-11 01:39:06
7
- PHP 8.1 / MySQL 8.0 array_push array_unique var_export
last run:
2024-06-30 22:29:16
7
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode print_r array_unique
last run:
2023-11-01 17:15:00
6
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode array_unique print_r
last run:
2023-11-01 18:05:32
6
- PHP 8.1 / file_get_contents simplexml_load_string json_encode json_decode array_unique print_r
last run:
2023-11-01 17:12:39
6
array_unique - New snippets
-
PHP 8.1 / array_map array_unique print_r
added at:
2025-01-30 10:59:08
1
-
/ array_unique print_r array_count_values
added at:
2025-01-20 21:15:24
1
-
/ array_unique print_r array_count_values
added at:
2025-01-20 21:15:02
1
-
/ array_unique print_r array_column
added at:
2025-01-20 21:14:03
1
-
/ array_unique print_r array_count_values array_column
added at:
2025-01-20 21:13:39
1
-
/ array_unique print_r array_count_values array_column
added at:
2025-01-20 21:13:14
1
-
/ array_unique print_r
added at:
2025-01-20 21:12:25
1
-
/ array_unique print_r
added at:
2025-01-20 21:11:26
1
-
/ array_unique print_r array_column
added at:
2025-01-20 21:09:47
1
-
/ array_unique array_count_values array_column print_r
added at:
2025-01-20 21:06:04
1