php style guides
| From: | Tim Burgan | Date: | Wed, 12 Jan 2005 13:04:59 +0000 |
| Subject: | php style guides | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-206177@lists.php.net to get a copy of this message | ||
Hi everyone,
What 'rules' do you follow about styling/formatting your PHP code? Do you follow a guide that is available online?
I generally have my own preference for formatting like
if ( condition )
{
statements;
}
for all conditional statements and loops, as opposed to
if (condition) {
statements;
}
But what I'm really wanting to get everyones thoughts about is in regard to combining PHP with HTML.
I used to do:
<?php
echo "blah";
?><h1>test</h1><?php
echo "blah";
?>
but just tried
<?php
echo 'blah';
echo '<h1>test</h1>';
echo 'blah';
?>
which I find it's much easier to read to code.
What do other people do and for what reason? What are the advantages/disadvantages to doing it certain ways?
Thanks for your time.
Tim