-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1403.php
More file actions
47 lines (39 loc) · 895 Bytes
/
1403.php
File metadata and controls
47 lines (39 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
echo 'Hello';
// function number(array $lines): array
// {
// $finalAry = [];
// foreach ($lines as $key => $value) {
// $upKey = $key + 1;
// (string)$element = "$upKey: $value";
// echo $element;
// array_push($finalAry, $element);
// }
// return $finalAry;
// }
// $output = number(["a", "e", "ert"]);
// print_r($output);
function number(string $lines, $key)
{
$key += 1;
return "$key: $lines";
}
$lines = ["A", "B", "C"];
print_r(array_map("number", $lines, array_keys($lines)));
// function myfunction($v)
// {
// return ($v * $v);
// }
// $a = array(1, 2, 3, 4, 5);
// print_r(array_map("myfunction", $a));
// function myData(array $ar): string
// {
// return 'test';
// }
// $myName = '2';
// $result = match ($myName) {
// 2 => 'two',
// default => 'unknown'
// };
// echo $result;
echo PHP_VERSION;