From bc6b91a43fcd965a471724a6ee946f0f87d5d5af Mon Sep 17 00:00:00 2001 From: Paolo Mainardi Date: Wed, 3 Jul 2013 13:31:09 +0200 Subject: [PATCH] Ternary operator example --- php.html.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/php.html.markdown b/php.html.markdown index 75bbd214..f0c5c918 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -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: ?>