In Between PHP Tags
if(condition){
?>
<!-- HTML here -->
<?
}
In Echos
if(condition){
echo "HTML here";
}
I use above two methods in my code. But I’m wondering which one is the industry standard and good for performance? Are there any pros and cons of above methods? Which method should I use? and Why?
Since I’m new to PHP I hope you guys will help me out to figure this out. Thanks
Best industry practice is normally to keep your HTML and your PHP completely seperate (see http://www.smarty.net/ as an example of a templating system)
However, you might find your editor will do nicer syntax highlighting if you don’t put your HTML in echos