forked from codigoconjuan/PHP_Introduction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path17_math.php
78 lines (61 loc) · 1.96 KB
/
17_math.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Introduction to PHP</title>
<link rel="stylesheet" href="css/style.css">
<link href="https://fonts.googleapis.com/css?family=Lato:400,900&subset=latin-ext" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Up & Running with PHP</h1>
<div class="code-content">
<?php
echo 2 + 2;
echo "<br/>";
echo 2 / 1;
echo "<br/>";
echo 3 * 4;
echo "<br/>";
echo 10 - 5;
echo "<br/>";
echo (10 * 2) + 5;
echo "<br/>";
//increment in the same variable;
$total = 20;
$total += 20;
$total += 10;
$total -= 20;
$total *= 2;
$total /= 2;
echo "Total is: " .$total . "<br/>";
/*
for($i = 0; $i <= 100; $i++) {
if($i % 2 == 0) {
echo "The number: " . $i . " is even <br/>";
} else {
echo "The number: " . $i . " is odd <br/>";
}
}
*/
$number = 2;
echo $number;
echo "<br/>";
echo ++$number;
// Fizzbuzz
for($i = 0; $i <= 100; $i++) {
if(($i % 5 == 0) && ($i % 3 == 0) ) {
echo $i . " FIZZBUZZ <br/>";
} else if ($i % 5 == 0) {
echo $i . " Buzz <br/>";
} else if ($i % 3 == 0) {
echo $i . " Fizz <br/>";
} else {
echo $i . "<br/>";
}
}
?>
</div>
</div>
</body>
</html>