diff --git a/index.php b/index.php index ff183a17bf13acfa9673cbc193be270e7a109a53..d5bf4b12fdb59b5cab5f3707b8e92d60d56b2c27 100644 --- a/index.php +++ b/index.php @@ -37,5 +37,17 @@ ]; print_r($func->search($array, 54)); ?> + + +

Function 3

+ uniqElements($arr)); + ?> \ No newline at end of file diff --git a/src/Functions.php b/src/Functions.php index 2c2ad2af35a9d442745830bd8ef129c2646f6bed..38a5f9ba6e32a5143c4169eaba47e7b6b5c35149 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -52,5 +52,25 @@ class Functions } return null; } + + /** + * Удалить дубликаты, оставив только уникальные значения + * @param array $array + * @return array + */ + + public function uniqElements(array $array): array + { + return array_unique($array, SORT_REGULAR); + } + + /** + * Выходной массив: + * Array ( + * [0] => Array([0] => laravel, [1] => php) + * [1] => Array([0] => codeigniter, [1] => php) + * [3] => Array([0] => c++, [1] => java)) + * ) + */ }