Use full PHP tags
Write:
<?php print $foo; ?>
Don't write:
<? print $foo; ?>
Semicolons
Write:
<?php print $foo; ?>
Don't write:
<?php print $foo ?>
No closing tags
When writing a module or customizing your theme template.php, don't use PHP closing tag ?>.
Notice that at the bottom of the following snippet, there is no PHP closing:
<?php
// Your file starts here
function phptemplate_foo() {
return $bar;
}
// Your file ends here
// Don't add PHP closing tag
// Your file starts here
function phptemplate_foo() {
return $bar;
}
// Your file ends here
// Don't add PHP closing tag
By doing this you prevent PHP interpreter to stop and restart on the next source code file. This mean better performance.