<?php
foreach($pricelistline as $value) {
$e = explode(",",$value);
if ($e[0]) {
echo "<li>\n<img width=\"24\" height=\"24\" src=\"features_icons/" . $e[0] . ".png\" alt=\"\" class=\"\" />\n<span>" . str_replace("-", " ", ucfirst($e[0])) . "</span>\n</li>\n";
}
}
?>
And this_
<?php
foreach($pricelistline as $value) {
$e = explode(",",$value);
if ($e[0]) {
?>
<li>
<img width="24" height="24" src="features_icons<?php echo $e[0]; ?>.png" alt="" class="" />
<span><?php echo str_replace("-", " ", ucfirst($e[0])); ?></span>
</li>
<?php
}
}
?>
In general is there any difference performance wise?
Is there any difference in speed and load?
Does exiting and entering php multiple times degrade performance? <?php >
Which one is considered a better practice?
Is there any difference between 1 instance of echo vs 2 instances?
Entering and exiting PHP, as opposed to echoing strings, has the advantage that a text editor can syntax highlight the HTML. If it’s inside a PHP string, it cannot.
Performance-wise, I believe the difference to be completely insignificant and therefore irrelevant. This is a case of premature micro-optimization. Whichever method you choose, it is sure not to be the bottleneck in your application. If your application isn’t performing adequately, then do profiling to identify what’s actually taking too long.