if else short hand failed in PHP -


<input type="submit" value="<? get_the_category( $id )[0]->name == 'english' ? echo 'find' : echo 'encontrar'; ?>"> 

not sure problem here, have problem doing shorthand of if else condition.

please ensure can't use echo way since has no return type.

you can try either of these:

<?php echo (get_the_category( $id )[0]->name == 'english') ? 'find' : 'encontrar'; ?> 

or

<? get_the_category( $id )[0]->name == 'english' ? print 'find' : print 'encontrar'; ?> 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -