Hello. Such a strange question I had. What is more optimal from the point of view of server, browser and HTTP resources — use the echo statement several times or collect the html code into a variable and then throw it into the browser? For example:
$html = ""; for ($i = 0; $i < 100; $i ++) { $html .= "<p> $i - <img src='images/image_$i.png' /></p>"; } echo $html; or
for ($i = 0; $i < 100; $i ++) { echo "<p> $i - <img src='images/image_$i.png' /></p>"; }
echowith concatenation will never be the solution. Get real optimizations. - VladD