Re: PHP Standard style of writing your code

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

 



----- Original Message ----- From: "Richard Lynch" <ceo@xxxxxxxxx>


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!

--

The Php compiler http://www.phpcompiler.org/ might help you with reformatting. Look at: http://www.phpcompiler.org/doc/convertingphp.html. If you add no extra code to the compiler, it will produce a reformatted version of the original. I don't know it your IDE allows it but in the plain editor I use I could assign an external program to run, modify the source in the foreground and reload it once done.

Satyam

--
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