PHP Classes

Performance php/html vs html/php

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Performance php/html vs html/php  
Subject:Performance php/html vs html/php
Summary:Best way to decrease a web page load time
Messages:9
Author:Francis
Date:2017-10-19 02:20:00
Update:2019-01-18 19:13:38
 

  1. Performance php/html vs html/php   Reply   Report abuse  
Picture of Francis 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

There are 8 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.