Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • a.shamavov/tasks-php
1 result
Show changes
Commits on Source (9)
......@@ -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))
* )
*/
}