views:

1012

answers:

5

Should I stick with Sun's Java code conventions for PHP code?

+20  A: 

For PHP, i'd suggest to follow Zends suggestions

As you might know, Zend is the most widely used framework!

Prakash
More importantly, Zend is the company that writes the PHP engine... hence why PHP5 uses the Zend Engine, version 2.
R. Bemrose
What exactly does them having written the Zend Engine have to do with following the coding conventions of their framework?
Franz
+2  A: 

If you are in a business follow the business code convention.

If it's for a personal project you can get the specific language specification (if you do Java than Java, if you do Php than PHP). If it's your personal project you can change few things if you desire...

If you do open source project, you should go see what's already in place.

Daok
+1  A: 

There are many different coding conventions out there. Have a look at what other people use (read some example code and see how easy it is to understand what is being done) and take your pick.

The important part is to choose one and stick to it.

Treb
+4  A: 

You have a number of options:

Zend: http://framework.zend.com/manual/en/coding-standard.html

Pear: http://pear.php.net/manual/en/standards.php

Wordpress: http://codex.wordpress.org/WordPress_Coding_Standards

But like prakash suggests, Zend is a good choice.

A: 

http://www.symfony-project.org