Condensing multiple echo expressions into one from PHP?

I am relatively new to PHP and want to know a more efficient way to repeat the following in smaller steps or even a single statement.

echo '<div class="title-area"><a href="';
echo site_url();
echo '">';
echo get_bloginfo( 'name' );
echo '</a></div>';

      

This currently outputs a div containing the link for the blog title and the href of the site.

+3


source to share


1 answer


How about this

echo '<div class="title-area"><a href="'.site_url().'">'.get_bloginfo( 'name' ).'</a></div>';

      



You just need to use concatinate instead echo

multiple times

+3


source







All Articles