Saturday, 19 January 2013

Ternary Operator use in php with Example

<?php
$a =10;$b= 9;
$res =($a >$b)?'greater':($a>4?'greater than 4':($a==3?'equal':'not equal'));
echo $res;
?>

No comments:

Post a Comment