Coding standards we follow..
We are normally using the ‘Smarty’ Template system plus ‘PEAR’ and ‘xAjax’ or ‘Zend Frame work’ plus ‘JQuery’ (according to the project requirement) with good quality and W3C valid HTML, CSS Designs.
Here describing the coding standards we normally follow (if there isn’t any special instructions from client),
PHP Code Tags:
<?php
Code line 1…..
Code line 2 ….
?>
Header Comment Block:
<?php
/**
* Short Description of File
* Long Description
* @Category CategoryName
* @Package PakageName
* @author Author <another@example.com>
* @version VER: $Id$
?>
Variable Names:
$var, $myName, $myAge …
For Class variables,
$_classvar1, $_classvar2 …
Control Strucures:
If.. Else..
<?php
if ((condition1) || (condition2)) {
} elseif ((condition3) && (condition4)) {
} else {
}
?>
Switch
switch (condition) {
}
?>
Function Definition:
<?php
/**
* Function description…
*@param type $bar
*@param type $baz
**/
function foo ( $bar, $baz ) {
}
?>
Class Definitions:
<?php
class ClassName {
}
?>
Comments:
C style comments (/* */) and standard C++ comments (//)