Re: PHP Standard style of writing your code

From: Date: Tue, 25 Apr 2006 06:50:23 +0000
Subject: Re: PHP Standard style of writing your code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234668@lists.php.net to get a copy of this message
On Tue, April 25, 2006 12:51 am, Martin Zvarík wrote: > I see everyone has its own way of writing the code. If there is 10 > programmers working on same thing, it would be good if they would have > same style of writing the PHP code. > > So, my question is: Is there anything what would define standard style > of writing PHP code? Yes, but... You can lock down every single little nuance of PHP style and document it all somewhere and require that all 10 programmers use THAT style. There are two possible outcomes to this: #1. Somebody actually enforces this document, and makes themselves REAL unpopulare, and probably all 10 programmers very unhappy, and they all quit. #2. Nobody actually enforces it; nobody follows it; you wasted time making it. The best general rule is probably to follow the style the original author used, as much as possible, when adding to or changing a file. The differences between placement of { and newlines and spaces and parentheses are pretty much a religious argument, not a technical argument, no matter how much people try to claim one is superior for readability. Hmmm. It would be Really Nifty if some fancy IDE out there would automatically render one's PHP code in the style preferred by the developer... 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! :-) Forget the stupid color-coding of the fucntions and all that crap. Gimme the code layout I want! -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#234668) next »