Page 1 of 1

Excessive PHP Tags

Posted: Fri Dec 19, 2008 10:06 am
by joby65
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

?>

Re: Excessive PHP Tags

Posted: Fri Dec 19, 2008 11:50 am
by Eran
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.