phpecho

How to print a string inside of PHP tags?


Why this code do not want to work ?

<?php
$currMonth='01';
?>

<a class="btn btn-xs btn-<?php ($currMonth=='01') ? 'primary' : 'default'; ?>-outline">

My output is empty:

<a class="btn btn-xs btn--outline">

Thanks.


Solution

  • It is working. It is just not outputting something because you haven't told php to do so. Change <?php to e.g. <?php echo.