One thing a lot of people do not understand about PHP, but I have had to learn since I am developing websites that take hundreds of thousands of users per month.
if you create something like this.
they have a tendancy to do it this way
- Code: Select all
while($item = mysql_fetch_assoc($qry)) {
$item_name = $item['name'];
print "<tr><td>Item Name: $item_name</td></tr>";
}
in reality that drains server resources more than if you just did this.
- Code: Select all
<?
while($item = mysql_fetch_assoc($qry)) {
?>
<tr><td><?=$item['name']?></td></tr>
<?
}
The main reason it is better to break in and out of PHP like this, is because the less you use the "print" function the more efficient your server can process, ALSO the less you define variables like $item_name = $item['name'] the less memory your server uses per user and the faster your pages will load when you have a lot of people online. So although yes it may seem annoying to break into and out of PHP constantly, it is better for your server.
The main reason for this is PHP is an old clunky grandmother, she has tons of wisdom but isn't as well oiled and good as she used to be, the replacement PHP is Ruby on Rails, but PHP is still the best by far for one big reason... it's been around the block a time or two, tons of people use it, meaning you have tons of plugins, ect... and it has tons of people working out the kinks.
Also, make sure you change any "print" commands in the phaos engine to say "echo", why you ask? echo doesn't return any variable, while everytime you use print it returns true, meaning if you print 30 things you have 30 variables stored in your server memory all saying "true" for no reason.. it adds up if you get my drift.
Just my 2 cents.