-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprec.php
179 lines (158 loc) · 3.48 KB
/
prec.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!-- <?php
$price = 450;
$discount = 12;
$value = $price - $price * $discount / 100;
echo "<p>$value pesos</p>";
// is the same as
$value = ($price - (($price * $discount)/100));
echo "<p>$value pesos</p>";
?> -->
<!-- <?php
$a = 600;
$b = 30;
$c = 5;
$x = $a / $b * $c;
echo "<p>$x</p>";
//is also same as
$x = (($a / $b) * $c); //left to right
echo "<p>$x</p>";
$x = $y = $z = $c;
echo "<p>$x</p>";
//is also same as
($x = ($y = ($z = $c))); // right to lefts
echo "<p>$x</p>";
?> -->
<!--
<?php
$x = 10;
//post increment
echo "<p>".$x++."</p>"; //10
//pre increment
echo "<p>".++$x."</p>"; //12
$y = 20;
//post decrement
echo "<p>".$y--."</p>"; //20
//pre decrement
echo "<p>".--$y."</p>"; //18
?> -->
<!-- <?php
$a = 10;
$b = 20;
$x = $a > $b ? "\$a is larger": "\$b is larger";
echo $x;
?> -->
<!-- <?php
$a = 135; $b = 45;
$c = $a & $b;
echo "<p>$c</p>";
$c = $a | $b;
echo "<p>$c</p>";
$c = $a ^ $b;
echo "<p>$c</p>";
$c = ~$b;
echo "<p>$c</p>";
$c = $b << 2;
echo "<p>$c</p>";
$c = $b >> 2;
echo "<p>$c</p>";
?> -->
<!-- <?php
$a = 50; $b = 80;
//if statement
if($a < $b) {
echo "<p>\$a is less than \$b</p>";
}
// if...else statement
if($a > $b) {
echo "<p>\$a is greater than \$b</p>";
} else {
echo "<p>\$a is less than or equal to \$b</p>";
}
//if..elseif..else
if($a > $b) {
echo "<p>\$a is greater than \$b</p>";
} elseif ($a < $b) {
echo "<p>\$a is less than \$b</p>";
} else {
echo "<p>\$a is equal to \$b</p>";
}
?> -->
<!-- <?php
$score = 86;
if($score > 80) {
if($score > 80) {
echo "Your score is between 80 to 91";
} else {
echo "Your score is higher than 90";
}
} else {
echo "Your score is loweer than 81";
}
?> -->
<!-- <?php
$score = 86;
if($score > 80 && $score < 91) {
echo "Your score is between 80 to 91";
} else if($score > 90) {
echo "Your score is higher than 90";
} else {
echo "Your score is lower than 81";
}
?> -->
<!-- <?php
$month = 2;
switch($month) {
case 1:
echo "January"; break;
case 2:
echo "Febuary"; break;
case 3:
echo "March"; break;
case 4:
echo "and so on up to 12"; break;
default:
echo "Invalid"; break;
}
?> -->
<!-- <?php
$x = 10;
while($x > 0) {
echo $x--." ";
}
echo "<br/>";
$y = 20;
do {
echo $y++." ";
} while($y < 21);
echo "<br/>";
$z = 5;
for($i = $z; $i > 0; --$i) {
echo $i." ";
}
?> -->
<!-- <?php
$i = 1;
while(true) {
$i++;
if($i < 20) {
continue;
} elseif($i >= 20 && $i < 30) {
echo $i."<br/>";
} else {
break;
}
}
goto display;
echo "This statement were skipped by goto";
display:
echo "statement from display label";
?> -->
<?php
$a = 10; $b = 20; $c = 30;
if($a < $b):
echo "<p>\$a is less than \$b</p>";
endif;
for($i = 1; $i < 11; $i++):
echo $i." ";
endfor;
?>