Skip to content
Snippets Groups Projects
Commit ba4144a2 authored by Nikita Chernykh's avatar Nikita Chernykh
Browse files

Merge branch 'PTPS_Function_3' into 'main'

Ptps function 3

See merge request !3
parents bc646cb7 f01d1dad
No related branches found
No related tags found
1 merge request!3Ptps function 3
......@@ -37,5 +37,17 @@
];
print_r($func->search($array, 54));
?>
<h1>Function 3</h1>
<?php
$arr = [
['laravel', 'php'],
['codeigniter', 'php'],
['laravel', 'php'],
['c++', 'java'],
];
print_r($func->uniqElements($arr));
?>
</body>
</html>
\ No newline at end of file
......@@ -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))
* )
*/
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment