PHP Ternary Operator not working for this code -
i use ternary operator below code..
<?php if($users['active'] == 1 ) { echo 'yes'; } else { echo 'no'; } ?> i tried using code , not work..
<?php ($users['active'] == 1) ? echo "yes" : echo "no"; ?> what wrong?
the echo goes outside of it, not in, (the ternary operator) returning value, not codeblock.
<?php echo ($users['active'] == 1 ? "yes" : "no"); ?>
Comments
Post a Comment