Insert PHP into Echo -



Insert PHP into Echo -

i trying insert below php echo having problem right formatting.

php:

<?php if ( isset($heroloc) ) { echo '@ '.$heroloc;} ?>

would place if statement below right after $created_time

echo '<span class="time">'.$created_time.'</span>';

somethign this, formatted properly:

echo '<span class="time">'.$created_time. if ( isset($heroloc) ) { echo '@ '.$heroloc;'</span>';

use ternary operator

<?php echo '<span class="time">'.$created_time.(isset($heroloc) ? '@ '.$heroloc : '').'</span>';

php

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -