snake_case_names
Each word is separated by an underscore (_
) and uses only lowercase letters. Named because it looks like a snake.
Use Cases for snake_case
Variables, hooks, function names, and method names in WordPress PHP standards.
SCREAMING_SNAKE_CASE
Each word is separated by an underscore (_
) and uses only uppercase letters. All uppercase letters is often interpreted as SHOUTING or SCREAMING.
Use Cases for SCREAMING_SNAKE_CASE
PHP constants and class constants when following PSR-12, PSR-2, or WordPress PHP standards.
kabob-case-names
Each word is separated by an dash (-
) and uses only lowercase letters. Named because it is reminiscent of a kebab, which is food cooker on a skewer.
kabob-case usage
Kabob-case is very popular for CSS classes (<p class="first-name">
), though some more complex systems (notably BEM use a mix of dashes (-
) and underscores (_
)) – perhaps we could call this snake-kebab_case.
Kabob-case is also very popular for naming files, e.g. my-file.pdf
.
camelCaseNames
Each word, with the exception of the first word, starts with an uppercase letter while the remaining letters in each word are lowercase. Named because of the visual similarity to a camel with hump(s).
camelCase usage
PHP function and method names when following PSR-12, PSR-2, or PSR-1.
PascalCaseNames
Each word, including the first word, starts with an uppercase letter while the remaining letters in each word are lowercase. Named because this naming standard is used in the programming language Pascal. Also known as UpperCamelCase.
Sometimes referred to as StudlyCaps, though technically STuDLycAPs use a variety of capital letters but not necessarily the first letter of each word.
PascalCase Usage
PHP classnames when following PSR-12, PSR-2, or PSR-1.
Camel_Caps
Each word should start with a capital and words should be separated by an underscore, e.g. Sub_Domain
.
Camel_Caps usage
The WordPress coding standards issue about namespaces, is one of the few places I’ve seen Camel_Caps discussed.
Leave a Reply