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 / MySQL 8.0 array_slice array_unique array_reverse print_r
last run:
2021-06-01 10:31:05
4
- PHP 8.0 / MySQL 5.7 count array_unique array_column
last run:
2022-03-13 16:31:16
3
- PHP 5 / MySQL 5.7 str_replace file_get_contents preg_match_all array_unique
last run:
2022-02-04 20:12:21
3
- PHP 8.0 / MySQL 8.0 array_unique implode array_fill count array_merge json_encode
last run:
2022-04-09 18:04:51
2
- PHP 8.0 / MySQL 5.7 json_encode array_unique array_values
last run:
2022-02-28 08:50:04
2
- PHP 8.0 / MySQL 5.7 print_r json_encode array_unique array_values
last run:
2022-02-18 13:20:55
2
- PHP 8.0 / MySQL 5.7 mb_strtoupper mb_substr implode array_unique preg_split mb_strtolower
last run:
2021-10-20 17:47:53
2
- PHP 8.0 / MySQL 5.7 implode array_unique preg_split mb_strtolower ucfirst
last run:
2021-10-20 09:40:11
2
- PHP 8.0 / MySQL 5.7 count array_unique array_filter
last run:
2021-10-22 02:09:16
2
- PHP 7 / MySQL 8.0 date strtotime array_unique print_r
last run:
2021-09-21 19:48:00
2
array_unique - New snippets
-
PHP 8.1 / MySQL 5.7 print_r array_unique explode
added at:
2022-06-23 14:39:05
1
-
PHP 8.1 / MySQL 5.7 print_r array_unique explode
added at:
2022-06-23 14:38:52
1
-
PHP 8.1 / MySQL 5.7 print_r array_unique explode
added at:
2022-06-23 14:38:45
1
-
PHP 8.0 / MySQL 8.0 array_unique implode array_fill count array_merge json_encode
added at:
2022-04-08 16:38:06
2
-
PHP 8.0 / MySQL 8.0 array_unique implode array_fill count array_merge json_encode
added at:
2022-04-08 16:37:37
1
-
PHP 8.0 / MySQL 8.0 array_unique count implode array_fill array_merge json_encode
added at:
2022-04-08 11:13:18
1
-
PHP 8.0 / MySQL 8.0 array_unique count implode array_fill array_merge json_encode
added at:
2022-04-08 10:59:13
1
-
PHP 8.0 / MySQL 8.0 array_unique count implode array_fill array_merge json_encode
added at:
2022-04-08 10:58:17
1
-
PHP 8.0 / MySQL 8.0 array_unique count implode array_fill array_merge json_encode
added at:
2022-04-08 10:57:33
1
-
PHP 8.0 / MySQL 8.0 array_unique count implode array_fill array_merge json_encode
added at:
2022-04-08 10:56:52
1