CodingStandards » History » Version 5

« Previous - Version 5/64 (diff) - Next » - Current version
jmd, 08/19/2006 02:11 AM


Indentation

One tabulation

{{{
// base level
// level 1
// level 2
// level 1
// base level
?>
}}}

Control structures Including files

require_once ?
include_once ?

PHP tags

Short tag not allowed. Use complet tags.

{{{

// code

?>
}}}

Functions

Function names should be written in camelBack, for example:

{{{
function userName() {
}
?>
}}}

Class

Class names should be written in CamelCase, for example:

{{{
class ExampleAuthentification {
}
?>
}}}

Variables

Variable names should be as descriptive and short as possible. Normal variables should start with a lowercase letter, and should be written in camelBack in case of multiple words.

?? Variables containing objects should start with a capital letter, and in some way associate to the class the variable is an object of.

Example:

{{{
$user = 'glpi';
$users = array('glpi', 'glpi2', 'glpi3');

$Computer = new Computer;
?>

}}}

Variable types ¶

Variable types for use in DocBlocks for Doxygene:

Type Description
mixed A variable with undefined (or multiple) type.
integer Integer type variable (whole number).
float Float type (point number).
boolean Logical type (true or false).
string String type (any value in "" or ' ').
array Array type.
object Object type.
resource Resource type (returned by for example mysql_connect()).
Files

Lower case

Constants

Capital letter :

{{{
COMPUTER_TYPE
}}}