-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9-conditional_statements.php
More file actions
50 lines (46 loc) · 1.24 KB
/
9-conditional_statements.php
File metadata and controls
50 lines (46 loc) · 1.24 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>PHP Conditional Statements</h1>
<p>Conditional statements are used to perform different actions based on different conditions.</p>
<?php
/*
## Syntax
if (condition) {
code to be executed if this condition is true;
} elseif (condition) {
code to be executed if first condition is false and this condition is true;
} else {
code to be executed if all conditions are false;
}
*/
$balance = 5;
$trip = 50;
if($balance >= $trip) {
echo 'ទៅដើរលេងបាន';
} else {
echo 'ទៅដើរលេងអត់បានទេ ព្រោះដាច់លុយ';
}
echo '<br>';
$score = 200;
if($score >= 427) {
echo 'A';
} elseif($score >= 380) {
echo 'B';
} elseif($score >= 332) {
echo 'C';
} elseif($score >= 285) {
echo 'D';
} elseif($score >= 237) {
echo 'E';
} else {
echo 'F';
}
?>
</html>