Facebooktwittergoogle_plusredditpinterestlinkedinmail

Changes in PHP ternary operator since PHP 5.3

Till PHP 5.2

$varName = ($cond) ? $cond : ‘false’;

From PHP 5.3

$varName = ($cond) ? : ‘false’;

No need to write condition for true. It will automatically taken $cond in true.

Changes in PHP Ternary Operator since PHP 5.3 Roopendra PHP
Changes in PHP ternary operator since PHP 5.3Till PHP 5.2$varName = ($cond) ? $cond : 'false';From PHP 5.3$varName = ($cond) ? : 'false';No need to write condition for true. It will automatically taken $cond in true.Reference URL :- http://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary
Changes in PHP ternary operator since PHP 5.3Till PHP 5.2$varName = ($cond) ? $cond : 'false';From PHP 5.3$varName = ($cond) ? : 'false';No need to write condition for true. It will automatically taken $cond in true. <div></div> <div>Reference URL :- <a href="http://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary" target="_blank" rel="nofollow nofollow">http://www.php.net/manual/en/<wbr />language.operators.comparison.p<wbr />hp#language.operators.comparis<wbr />on.ternary</a></div>
(Visited 60 times, 1 visits today)
Facebooktwittergoogle_pluslinkedinrss