I have a hopefully very quick query about generally accepted practices when writing PHP. PHP ignores most whitespace, giving you a lot of functionally identical options when writing your code. I was wondering whether there were some clear, widely accepted practices around this, or whether it's a matter of personal preference?
I've always been in the habit of writing PHP with a minimum of whitespace. I put a line break in (1) after a semicolon; (2) after a left curly bracket; (3) before and after a right curly bracket. So like this:
Code: Select all
function x(){
callfunction($arg1,$arg2);
callanotherfunction($longargment1,$longargment2,$longargment3,$longargment4);
}Code: Select all
function x ()
{
callfunction ( $arg1, $arg2 );
callanotherfunction (
$longargment1,
$longargment2,
$longargment3,
$longargment4
);
}