Page 1 of 1

PHP Coding Standards?

Posted: Mon Nov 27, 2006 7:17 pm
by zeek
I have been writing PHP for years now. I've no doubt written tens of thousands of lines of code, and over the years have used many different naming, formatting, and commenting conventions, etc. The thing is, I have always written code directly for the server. It was never reviewed or used in a team environment. Now I need to write a small application as part of a job application, and I want to make sure that it is right.

I found this PHP Coding Standard page: http://www.phpe.net/html/php_coding_standard.html

It is 3 years old, and I just wanted to ask if someone wouldn't mind scanning over it very briefly, and letting me know if the information still holds true. Any tips or thoughts would be appreciated.

I know that these standards are debatable, and everyone has an opinion, but this will be reviewed by a team of programmers who work for a large company, and I want to make sure that I don't loose points because I didn't comment correctly, or put my brackets on a new line.

Thanks in advance.

Posted: Mon Nov 27, 2006 8:18 pm
by Ambush Commander
Without looking at the page, my advice is to: 1. Be consistent and 2. Use a style that's comfortable with you. You should be flexible and be able to adapt to different styles, as if you get hired, you should adopt the company's coding style (if they have one, heh heh). They shouldn't dock points for BSD bracing if they didn't tell you they use K&R bracing.

I'd recommend:

* http://pear.php.net/manual/en/standards.php
* http://framework.zend.com/manual/en/cod ... ndard.html

...both widely used standards throughout the PHP community, although by no means dominant.

Thanks

Posted: Mon Nov 27, 2006 9:10 pm
by zeek
Thank you for your response -- and the links.