Is it more efficient to use a single open and close tag (<?php ?>) and output html using echo, or should many php tags be used so that html is outputted normally?.
Example:
1. <?php
if(condition)
{
echo 'some html';
}
?>
2. <?php
if(condition)
{
?>
some html
<?php
}
continue ph script
?>
Excessive PHP Tags
Moderator: General Moderators
Re: Excessive PHP Tags
No, the opposite is true. The parser will ignore anything not inside a php tag, so it actually has (slightly) less work to do. I also find HTML to be more readable when it's outputted normally.