-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshorthands.php
51 lines (41 loc) · 902 Bytes
/
shorthands.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
<?php
$loggedIn = false;
$arr = [1,2,3,4,5];
/*
if($loggedIn){
echo 'You are logged in';
} else {
echo 'You are NOT logged in';
}
//echo ($loggedIn) ? 'You are logged in' : 'You are NOT logged in';
$isRegistered = ($loggedIn == true) ? true : false;
echo $isRegistered;
$age = 7;
$score = 12;
echo 'Your score is: '.($score > 10 ? ($age > 10 ? 'Average': 'Exceptional'):($age > 10 ? 'Horrible':'Average'));
*/
?>
<div>
<?php if($loggedIn) { ?>
<h1>Welcome User</h1>
<?php } else { ?>
<h1>Welcome Guest</h1>
<?php } ?>
</div>
<div>
<?php if($loggedIn): ?>
<h1>Welcome User</h1>
<?php else: ?>
<h1>Welcome Guest</h1>
<?php endif; ?>
</div>
<div>
<?php foreach($arr as $val): ?>
<?php echo $val; ?>
<?php endforeach; ?>
</div>
<div>
<?php for($i = 0;$i < 10;$i++): ?>
<li><?php echo $i; ?></li>
<?php endfor; ?>
</div>