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 ….
?>

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)) {

action1;

} elseif ((condition3) && (condition4)) {

action2;

} else {

action3;

}
?>

Switch

switch (condition) {

case 1:
action1;
break;
case 2:
action2;
break;
default:
defaultaction;
break;

}
?>

Function Definition:
<?php
/**
* Function description…
*@param type $bar
*@param type $baz
**/
function foo ( $bar, $baz ) {

//Code here …

}

$var =
foo($bar, $baz);

?>

Class Definitions:

<?php

class ClassName {

//… code goes here

}

?>

Comments:

C style comments (/* */) and standard C++ comments (//)