Miscellaneous naming conventions

CI guidelines have some general naming conventions, such as the following:

  • Your classes, functions, and parameters should have short names, and if constructed from several words they should use the underscore separator as follows:
    // several lowercase words naming with under score
    get_file_properties();
  • When defining a string value, in case the string does not have a parameter to evaluate, we shall use a single comma as follows:
    $my_string   = 'the string';
  • In case we want our string to have a parameter such as $name, we write our string using double quotes:
    $name = 'big string parameter';
    $my_string = "This is a $name ";
  • The Boolean and contacts all should be in upper case:
    $this_vale = FALSE;
    // While in javascript we shall use true / false 
    // to distinguish

For more general CI PHP style guide refer to http://codeigniter.com/user_guide/general/styleguide.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.35.247