In my project iam using PHP and HTML. Iam not sure how performance would reflect if I echo HTML in PHP or when I close pHP and then write HTML code.
Below are the 2 ways I can code: echo HTML within PHP
<?php
if(!$result) {
$qwe = 'something';
}
echo '<p>'.$qwe.'</p>';
echo '<p>lots of html tags will be echoed.'</p>
if('something happens') {
'do something'
}
?>
or close PHP tags and then write HTML
<?php
if(!$result) {
$qwe = 'something';
}
?>
<p><?php echo $qwe; ?></p>
<p>lots of html tags will be echoed.</p>
<?php
if('something happens') {
'do something'
}
?>
Is there any difference between these two? Any noticeable performance differences?. My project uses a lot of PHP to manipulate data and usually with more than 20k rows from MySQL query. I want to write a code which is optimised for high performance. I have been learning on query optimisation, just wondering if the above also can be tweaked.
And is there anything else I need to consider to optimise.