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
array
The input array.
int
The optional sorting flags. It can be any combination of SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_LOCALE_STRING, SORT_NATURAL, SORT_FLAG_CASE or SORT_NATURAL_CASE.
Return Values
Returns the filtered array.More information about array_unique on official PHP documentation site
array_unique - Popular snippets
- PHP 7.4 / MySQL 8.0 array_slice array_unique array_reverse print_r
last run:
2022-11-28 09:51:39
5
- PHP 8.0 / MySQL 8.0 array_push explode var_export array_unique
last run:
2022-09-07 06:20:39
3
- PHP 8.0 / MySQL 5.7 count array_unique array_column
last run:
2022-03-13 16:31:16
3
- PHP 5.6 / MySQL 5.7 str_replace file_get_contents preg_match_all array_unique
last run:
2022-02-04 20:12:21
3
- PHP 7.4 / MySQL 8.0 array_values array_unique print_r
last run:
2023-03-15 18:52:13
2
- PHP 8.1 / MySQL 5.7 array_unique array_values rsort array_search printf
last run:
2023-01-10 04:38:04
2
- PHP 8.1 / MySQL 5.7 print_r array_unique
last run:
2022-12-06 18:29:37
2
- PHP 8.1 / MySQL 8.0 array_push array_unique var_export
last run:
2023-03-23 05:32:09
2
- PHP 8.1 / MySQL 5.7 session_start array_map array_unique print_r
last run:
2022-07-28 08:54:19
2
- PHP 8.1 / MySQL 5.7 session_start array_map array_unique print_r
last run:
2022-07-28 08:45:39
2
array_unique - New snippets
-
PHP 8.0 / MySQL 5.7 print_r array_unique
added at:
2023-03-17 07:52:20
1
-
PHP 8.0 / MySQL 5.7 array_unique
added at:
2023-03-17 07:51:48
1
-
PHP 8.0 / MySQL 5.7 array_unique
added at:
2023-03-17 07:49:51
1
-
PHP 7.4 / MySQL 8.0 array_values array_unique print_r
added at:
2023-03-15 18:52:11
2
-
PHP 7.4 / MySQL 8.0 array_values array_unique print_r
added at:
2023-03-15 18:51:46
1
-
PHP 8.1 / MySQL 5.7 array_map array_unique print_r
added at:
2023-02-13 16:39:09
1
-
PHP 8.1 / MySQL 5.7 array_map array_unique print_r
added at:
2023-02-13 16:39:01
1
-
PHP 8.1 / MySQL 5.7 array_unique array_merge
added at:
2023-01-16 14:00:20
1
-
PHP 8.1 / MySQL 5.7 array_unique array_values rsort array_search printf
added at:
2023-01-10 04:39:38
1
-
PHP 8.1 / MySQL 5.7 array_unique array_values rsort array_search printf
added at:
2023-01-10 04:39:31
1