-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
116 lines (83 loc) · 1.65 KB
/
index.php
File metadata and controls
116 lines (83 loc) · 1.65 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
// $num1 = 1;
// $num2 = 2;
//arithmic operators
// $sum = $num + $num2;
//assignment operators
// $num1 += $num2;
// //comparison operators
// $num1 = 1;
// $num2 = "2";
// $num1 != $num2;
// $num1 === $num2;
// $num1 < $num2;
// //Spaceship
// 1;
// 2;
// -1;
// $num1 <=> $num2;
// 2;
// 1;
// 1;
// $num1 <=> $num2;
// 1;
// 1;
// 0;
// $num1 <=> $num2;
// //Logical Operators
// $num1 = 5;
// $num2 = 10;
// $num1 === 5 xor $num2 === 6; // Only 1 can be true
// // Increment/Decrement
// $num1 = 5;
// ++$num1; // first its 6 later 6
// $num1++; // first its 5 later 6
// //String Operator
// $a = 'My Name ';
// $b = "is Daniel!";
// $c = $a . $b; // Punctuation == add them together
// // String
// $name = 'Coding is fun';
// // Integer
// $name = 12;
// // Float
// $name = 12.2123;
// // Boolean
// $true = 1;
// $false = 0;
// Array
$names = array("Daniel", "Dennis", "Michael");
echo $names['0']; // Daniel
echo $names['1']; // Dennis
echo $names['2']; // Michael
$a = 1;
$b = 2;
if ($a === $b) {
echo "They are the same";
} else if ($b === 5) {
echo "Var 'b' is equal to 5";
} else {
echo "They are NOT the same";
}
switch ($a) {
case 25:
echo "Var is rqual to 25";
break;
case 50:
echo "Var is equal to 50";
break;
default:
echo "None were true";
break;
}
?>
</body>
</html>