View Single Post
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2007-11-18, 13:53

While I don't often follow my own advise, Gargoyle is correct about trying to format your PHP. I normally do format it because I'm bad person, but it's really a lot better if you don't. That is one of the reasons I recommend smarty, because while it may make outputting easier to read, it definitely makes your PHP code easier to read. However, for shame Gargoyle about not using putting quotes around your id attribute. You know better He needs to be force fed XHTML.


Also keep in mind you can always break out of your PHP:
[PHP]<?php
//…
foreach($rows as $rowNum)
{
?><td><?
echo('Row: '.$rowNum);
?><br /><?
echo('Col: '.$colNum;
?></td><?
}
//…
?>[/PHP]

And some random tips:
Single quoted strings ('like this') are faster because PHP doesn't have to parse them looking for escaped characters and variables in double quoted strings ("like this").
When you use echo, it's faster to separate items by a comma than to concatenate them with a period.
  quote