What is the best way to post this echo?

4

What is the best way to post this echo? I know it's missing some quotes, I just do not know where to put it.

<?php

echo '<a href="page.php"><em>' <?php echo $locale->translate('ID'); ?> '</em></a>';

?>
    
asked by anonymous 11.08.2015 / 20:43

2 answers

5

I would invert the code, I would leave the HTML calling php and not the other way around:

<a href="page.php"><em><?php echo $locale->translate('ID'); ?></em></a>'

However, if you want to start from PHP itself:

<?php

echo '<a href="page.php"><em>' . $locale->translate('ID') . '</em></a>';

?>
    
11.08.2015 / 20:48
5

You must concatenate and not echo echo.

<?php
echo '<a href="page.php"><em>' . $locale->translate('ID') . '</em></a>';
?>
    
11.08.2015 / 20:48