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 8.1 / MySQL 8.0 array_push array_unique var_export
last run:
2023-08-16 09:31:06
5
- 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_unique explode implode
last run:
2023-08-25 06:45:11
3
- 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_push array_unique var_export
last run:
2023-08-16 10:46:35
2
- PHP 7.4 / MySQL 5.7 str_replace mb_strtolower explode array_unique print_r
last run:
2023-06-28 09:53:24
2
- PHP 7.4 / MySQL 5.7 str_replace mb_strtolower explode array_unique print_r
last run:
2023-06-28 09:53:47
2
- PHP 7.4 / MySQL 5.7 str_replace strtolower explode array_unique print_r
last run:
2023-06-28 09:44:30
2
array_unique - New snippets
-
PHP 8.0 / MySQL 8.0 array_unique explode addcslashes implode
added at:
2023-08-25 06:40:41
1
-
PHP 8.0 / MySQL 8.0 array_unique explode implode
added at:
2023-08-25 06:40:18
3
-
PHP 8.0 / MySQL 8.0 array_unique explode implode
added at:
2023-08-25 06:40:07
1
-
PHP 8.0 / MySQL 8.0 array_unique explode implode
added at:
2023-08-25 06:39:28
1
-
PHP 8.0 / MySQL 8.0 array_unique explode var_export implode
added at:
2023-08-25 06:38:50
1
-
PHP 7.4 / MySQL 8.0 array_push array_unique var_export
added at:
2023-08-16 09:31:17
2
-
PHP 7.4 / MySQL 5.7 str_replace mb_strtolower explode array_unique print_r
added at:
2023-06-28 09:59:59
1
-
PHP 7.4 / MySQL 5.7 str_replace mb_strtolower explode array_unique sort print_r
added at:
2023-06-28 09:59:19
1
-
PHP 7.4 / MySQL 5.7 str_replace mb_strtolower explode array_unique print_r sort
added at:
2023-06-28 09:58:35
1
-
PHP 7.4 / MySQL 5.7 str_replace mb_strtolower explode array_unique print_r
added at:
2023-06-28 09:57:03
1