mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Ternary operator example
This commit is contained in:
parent
03ac46f566
commit
bc6b91a43f
@ -231,6 +231,9 @@ if (false) {
|
||||
print 'Does';
|
||||
}
|
||||
|
||||
// ternary operator
|
||||
print (false ? 'Does not get printed' : 'Does');
|
||||
|
||||
$x = 0;
|
||||
if ($x === '0') {
|
||||
print 'Does not print';
|
||||
@ -240,6 +243,8 @@ if ($x === '0') {
|
||||
print 'Does print';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This alternative syntax is useful for templates:
|
||||
?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user