Created
November 10, 2012 01:47
-
-
Save olavocneto/4049447 to your computer and use it in GitHub Desktop.
In expression (expr1) ? (expr2) : (expr3), if not set expre2 and expr1 is true then print 1 when echo usage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$var = "string"; | |
echo isset($var) ? : 'ooh'; // 1 | |
//echo isset($var) ? : ; // Parse error: syntax error, unexpected ';' | |
var_dump(isset($var) ? : 'ooh'); // boolean true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment