naming in programming

Class and Method Naming

Class names should always start with an uppercase letter. Multiple words should be separated with an underscore. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.

class Class_name {
 
	function get_file_properties() {} // descriptive, underscore separator, and all lowercase letters
 
}

Variable Names

Variables should contain only lowercase letters, use underscore separators, and be reasonably named to indicate their purpose and contents. Very short, non-word variables should only be used as iterators in for() loops.

for ($j = 0; $j < 10; $j++)
$str
$buffer
$group_id
$last_city

Leave a Reply

Your email address will not be published. Required fields are marked *