What are PHP coding standards?

What are PHP coding standards?

There are few guidelines which can be followed while coding in PHP. Indenting and Line Length − Use an indent of 4 spaces and don’t use any tab because different computers use different setting for tab. It is recommended to keep lines at approximately 75-85 characters long for better code readability.

What do you need to know about PHP coding style?

PHP Coding Standards Edit

  • Single and Double Quotes.
  • Indentation.
  • Brace Style.
  • Use elseif , not else if.
  • Declaring Arrays.
  • Closures (Anonymous Functions)
  • Multiline Function Calls.
  • Regular Expressions.

What is PSR code?

The PHP Standard Recommendation (PSR) is a PHP specification published by the PHP Framework Interop Group. It comprises what should be considered the standard coding elements that are required to ensure a high level of technical interoperability between shared PHP code.

Does PHP use camelCase?

Internally, PHP itself uses Underscores for variables and functions, camelCase for Methods, and PascalCase for Classes, as stated in this PHP documentation page (userlandnaming. rules), and as spelled out in this PHP coding standards document. That said, various frameworks follow different conventions of their own.

How do you name a class in PHP?

Class names should be descriptive nouns in PascalCase and as short as possible. Each word in the class name should start with a capital letter, without underscore delimiters. The class name should be prefixed with the name of the “parent set” (e.g. the name of the extension) if no namespaces are used.

Why is camelCase bad?

K&R style vs camel case Words are not capitalized and are separated by underscores. camelCase and CamelCase are ugly to look at. Space between words (as in K&R style) is seen as a great advance in Western history. The evils of camelCase have been decried in the pages of the New York Times.

What are the tools required for PHP?

Top 10 PHP Development Tools For Efficient PHP Developers

  1. PHPStorm. Lightweight, extremely fast and smooth, PHPStorm is a standard choice for PHP development tools.
  2. Zend Studio. Most web developers opt for Zend Studio because of its optimal speed.
  3. NuSphere PhpED.
  4. Netbeans.
  5. Cloud 9.
  6. Aptana Studio.
  7. CodeLobster.
  8. Sublime Text.