So I was reading and I found that the de facto stardard for PHP is unofficially set by Zend, because they wrote and maintain the Zend engine which runs PHP.
http://framework.zend.com/manual/en/coding-standard.html
indents should be 4 spaces
braces should be on their own lines
concatination always has a space before and after the operator, although ' , ' is faster than ' . ' for echos
a single ' is preferred to a double "
lines should be no longer than 80 characters, 120 max
Language: PHP
function FooBar()
{
echo $something; OR echo {$something}; BUT NOT echo ${something};
}
So far as adding PHP in HTML goes, adding a single instruction on one line is okay, crammed right into the HTML, and usually there shouldn't be a need to have more than one line, because all other operations should be contained in a seperate PHP file.
The first column of your PHP should not be indented from the PHP tags.
I think that if you avoid echoing HTML tags, which seems to be the main problem creating uneccesarry white space, you will be okay.
It also seems to me that echoing HTML tags must be bad practice, as you usually want things like presentation, structure and logic to be separate.
If I look back at my project now, I can see that I could have done the whole thing without echoing any tags.
Just some random info.