Page 1 of 1

On a question of speed

Posted: Fri Jan 22, 2010 2:20 pm
by liderbug
Question: Is a web page faster to do everything under PHP or only use PHP on a limited basis - 1 large all inclusive PHP script or 27 one liners?
I.E.
<? php
echo "<table><tr><td> ...
mysql_query ("select * from ...
echo "$data[0] ...
etc etc etc

OR

<table><tr><td>
<?php mysql_query("select * from ... echo "$data[0] ?>
</td></tr>
</table>

Just an Enquiring mind... :?: or :crazy:
Thanks

Re: On a question of speed

Posted: Fri Jan 22, 2010 3:23 pm
by Christopher
99% of the time taken by that code is the query. The difference is not worth it. You should focus on implementing it in the cleanest, most maintainable way. Tune later if you actually have a performance problem.

You will get the most benefit in PHP from: optimizing your SQL queries, using an opcode cache like APC, tuning HTTP caching.