Ternary conditional operator in PHP?
Posted by Raj
Ternary conditional operator:
Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.
Syntax:
Condition ? value if true :value if false;
Example:
<?php
$id = isset($_POST['name']) ? $_POST['name'] : false;
?>
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
conditional operator,
explode php,
OOP interview questions and answers,
PHP,
php implode,
PHP interview questions and answers,
Question,
Ternary conditional operator,
ternary operator
.You can leave a response, or trackback from your own site.