Coding standards Ba...

Coding standards Basics  


Member Admin
Joined: 2 years ago
Posts: 1
14/01/2020 8:18 am  

Coding Standards place a vital role in any programming language for achieving a high code quality and to write more readable and clean code. Below is the list of Basic coding standards.

  • Upgrade to the Latest Version of PHP
  • Use only regular PHP Opening and closing tags, don’t use short tags and other php opening and closing tags.
  • Indent code properly.
  • The closing ?> tag MUST be omitted from files containing only PHP.
  • PHP keywords must be in lowercase,The PHP constants true, false, and null MUST be in lower case
  • Always comment your code
  • Avoid unnecessary Variables(not copy variables unnecessarily)
  • C style comments (/* */) and standard C++ comments (//) are both fine. Use of Perl/shell style comments (#) is discouraged.
  • Reduce the Number of Database Queries
  • Naming Conventions:

              Variable Naming Conventions:

    • Case should never be used to differentiate between variable names. Every variable name in the current scope should be absolutely unique. Variable names
      should describe the content that they (will) contain, using either complete words or understandable abbreviations.
    • Use “lowerCamelCase” style (lowercase lettering on initial and capitalization on subsequent words) to name variable.
    • Global variables should be prepended with a ‘g’.
    • Global constants should be all caps with ‘_’ separators

      Class Name Naming Conventions:

      • Class Name Should Start with Uppercase Letter
      • Class name should only contain alphanumeric characters. Numbers are permitted in class names but are discouraged in most cases.
        Underscores and Uppercase letters are permitted in place of the word separator(first letter of each word)

                  Constant Naming Conventions:

      • Constant Name should be Uppercase and we can separte each word with underscore.

                  Method and functions Naming Conventions:

      • Method names MUST be start with lowercase.
      • Use underscore or Case Change methods to separate words
This topic was modified 2 years ago 6 times by Priyanka

Active Member
Joined: 6 months ago
Posts: 5
06/12/2021 10:06 am  

 I am very enjoyed this post. It's an informative topic. It helps me very much to solve some problems.


Please Login or Register