Francis - 2017-10-19 05:04:02
Hi guys,
Please: which of the following options is faster?
- Html environment:
<tag attribute="<?php echo PhpFunction($foo); ?>">
Some text <?php echo OtherPhpFunction($pippo); ?>.
</tag>
<div>Now is <?php echo Time(); ?>, hello <?php echo $fooName; ?>.</div>
or
- Php environment:
echo '<tag attribute="'.PhpFunction($foo).'">';
echo 'Some text '.OtherPhpFunction($pippo).'.';
echo '</tag>';
echo '<div>Now is '.Time().', hello '.$fooName.'.</div>';
Re-formulated better: suppose we have a pure html file, but saved in php format. Then, the php engine must (1) read it (analyze it), and then (2) virtually print it (send it to the client).
So, i could think it's quicker to work in pure php giving directly the command "echo" applyed on all the html content (for example an "echo" line by line); in this way only the second phase (sending the virtual page to the client) will be executed.
Or no?
Thanks anticipally,
Francesco