php - Incorrect shorthand if else statement -


i have following ternary operator:

<?php (strcmp($activetab,'profile') == 0 ? echo "active" : '');  ?> 

unfortunately not working expected. wish if condition true active echoed, otherwise nothing.

what doing wrong?

try now

<?php echo (strcmp($activetab,'profile') == 0) ?  "active" : '';  ?> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -