PHP Coding Standards?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
zeek
Forum Commoner
Posts: 48
Joined: Mon Feb 27, 2006 7:41 pm

PHP Coding Standards?

Post 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.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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.
User avatar
zeek
Forum Commoner
Posts: 48
Joined: Mon Feb 27, 2006 7:41 pm

Thanks

Post by zeek »

Thank you for your response -- and the links.
Post Reply