Skip to content
Snippets Groups Projects
Commit 6cfdbf5a authored by Адлан Шамавов's avatar Адлан Шамавов
Browse files

Merge branch 'PTPS_Function_4' into PTPS_Function_5

parents 5dd9d16f 238fd405
No related branches found
No related tags found
1 merge request!5Ptps function 5
......@@ -17,37 +17,37 @@
<body>
<h1>Function 1</h1>
<?php
$array = [
['price'=>10, 'count'=>2],
['price'=>5, 'count'=>5],
['price'=>8, 'count'=>5],
['price'=>12, 'count'=>4],
['price'=>8, 'count'=>4],
];
print_r($func->sortPrice($array));
$array = [
['price'=>10, 'count'=>2],
['price'=>5, 'count'=>5],
['price'=>8, 'count'=>5],
['price'=>12, 'count'=>4],
['price'=>8, 'count'=>4],
];
print_r($func->sortPrice($array));
?>
<h1>Function 2</h1>
<?php
$array = [
['id'=>10, 'name'=>'Jhon', 'age'=>23],
['id'=>32, 'name'=>'Alex', 'age'=>34],
['id'=>54, 'name'=>'Bob', 'age'=>45],
['id'=>6, 'name'=>'Mike', 'age'=>61],
];
print_r($func->search($array, 54));
$array = [
['id'=>10, 'name'=>'Jhon', 'age'=>23],
['id'=>32, 'name'=>'Alex', 'age'=>34],
['id'=>54, 'name'=>'Bob', 'age'=>45],
['id'=>6, 'name'=>'Mike', 'age'=>61],
];
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));
$arr = [
['laravel', 'php'],
['codeigniter', 'php'],
['laravel', 'php'],
['c++', 'java'],
];
print_r($func->uniqElements($arr));
?>
......@@ -71,7 +71,8 @@
];
print_r($func->prepareMenu($aMenu));
?>
<h1>Function 5</h1>
<?php
print "<h2>До НГ: </h2>";
......
......@@ -4,16 +4,13 @@ declare(strict_types=1);
namespace Hp\Test;
use DateTimeImmutable;
use Exception;
class Functions
{
/**
* Выполняет сортировку массива по убыванию цены
* @param array $array
* @return array
*/
* Выполняет сортировку массива по убыванию цены
* @param array $array
* @return array
*/
public function sortPrice(array $array): array
{
......@@ -140,7 +137,7 @@ class Functions
* ['name' => 'Посуда','depth' => 1,],]],
* ];
*/
/**
* Функция рассчитывает кол-во дней до нового года
* @param DateTimeImmutable $date дата от которой, необходимо рассчитать кол-во дней
......
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