-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdemo.php
81 lines (46 loc) · 1.27 KB
/
demo.php
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
$name = 'Miguel';
$isDev = true;
$age = 78;
define('LOGO_URL', 'https://cdn.freebiesupply.com/logos/large/2x/php-1-logo-svg-vector.svg');
$output = "Hola $name, con una edad de $age. 😝";
$outputAge = match (true) {
$age < 2 => "Eres un bebé, $name 👶",
$age < 10 => "Eres un niño, $name 👦",
$age < 18 => "Eres un adolescente, $name 👨🎓",
$age === 18 => "Eres mayor de edad, $name 🍺",
$age < 40 => "Eres un adulto joven, $name 👨💼",
$age < 60 => "Eres un adulto viejo, $name 👴",
default => "Hueles más a madera que a fruta, $name 👴",
};
$bestLanguages = ["PHP", "JavaScript", "Python"];
$bestLanguages[] = "Java";
$bestLanguages[] = "TypeScript";
$person = [
"name" => "Miguel",
"age" => 78,
"isDev" => true,
"languages" => ["PHP", "JavaScript", "Python"],
];
$person["name"] = "pheralb";
$person["languages"][] = "Java";
?>
<ul>
<?php foreach ($bestLanguages as $key => $language) : ?>
<li><?= $key . " " . $language ?></li>
<?php endforeach; ?>
</ul>
<h2><?= $outputAge ?></h2>
<img src="<?= LOGO_URL ?>" alt="PHP Logo" width="200">
<h1>
<?= $output ?>
</h1>
<style>
:root {
color-scheme: light dark;
}
body {
display: grid;
place-content: center;
}
</style>