large php sections vs. multiple php sections in html

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ehogan
Forum Newbie
Posts: 3
Joined: Wed Dec 17, 2008 10:55 pm

large php sections vs. multiple php sections in html

Post by ehogan »

Has there been any study as to which style practice is more efficient/faster on a webserver.

HTML that looks this, with multiple php sections:

Code: Select all

 
 <tag> blah </tag>
<?php some_php_function() ?>
 <tag> blah </tag>
 <tag> blah </tag>
<?php some_other_php_function() ?>
 <tag> blah </tag>
 
or code that looks like this with a single large php section:

Code: Select all

 
 <tag> blah </tag>
<?php some_php_function()
echo " <tag> blah </tag>\n";
echo " <tag> blah </tag>\n";
    some_other_php_function() ?>
 <tag> blah </tag>
 
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: large php sections vs. multiple php sections in html

Post by Christopher »

I doubt if there is much if any difference. And you application is accessing any subsystem, such as a database, this code is a very insignificant part of the total time taken per request.
(#10850)
Post Reply