Re: PHP Standard style of writing your code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




So no matter what was actually typed, *I* would see:

function foo ($x) {
  //body
}

but some heretic who doesn't know any better would see:
function foo($x)
{
  //body
}

Now *THAT* would be a feature worth paying for in an IDE! :-)

Without caring what style you prefer, the correct reply to this request is the following:

   You seek a Code Beautifier for PHP.

I have found that only some IDE/Editor software contains such a beast. The convention for most software code editing tools is to have Shift + Ctrl + F do code formatting. I use PHP Eclipse to handle all my code formatting. It will allow you to choose your preference for braces up or down etc.

However...you may need to make a policy in your company. If you use source control for your software, it may see changes in formatting as a distinct major revision. Therefore, if you save code in "your" style and another developer opens the file and resaves in "his style", then you'll unnecessarily make version control a nightmare. Despite personal preference, you MUST adhere to the style of the project. If you are the sole developer, you define that style. If you are a coding monkey, then you may have to suffer with the style that the architect before you declared.

I can't work unless the code is formatted to my liking. I'm the OCD type of programmer. Luckily I'm also in control of coding standards within my company, whew! Get PHP Eclipse and do a general search for PHP Code Beautifier then download some you like and try them out.

Beautiful code often contains fewer bugs.

Dante


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux