Explanations with examples of the 4 most common naming conventions in programming: Camel case, Pascal case, kebab case, snake case and underscore case.
Naming conventions homogenize code, which has the advantage of making it easier for developers to find the names used in a project (both to name them and to call them) and to collaborate more easily when a code is written with several people. In all cases, it is advisable not to use accents or special characters (except in special cases, such as the jQuery framework which uses the dollar symbol "$" to name its main class).
The Camel case
Convention: words are linked without spaces. Each word begins with a capital letter with the exception of the first.
Examples: myVariableName, myUrl
The Pascal case
Convention: words are linked without spaces. Each word begins with a capital letter.
Examples: MyVariableName, MyUrl
This convention is used in the Pascal programming language or to name classes in PHP.
As for the Camel Case, only the first letter of the acronyms should be capitalized. This convention is also used by some brands to communicate an innovative aspect such as PlayStation, QuickTime or MasterCard.
The Kebab case or Spinal case
Convention: the words are in lower case and are linked by hyphens (-).
Examples: my-variable-name, my-url
The kebab case is recommended for writing URLs as well as naming images, PDFs and other files for the web. In programming, it is used, for example, to name classes and IDs in HTML and CSS code.
The name Kebab case actually refers to skewers much more than to the kebabs themselves, like a skewer of words made of dashes. As for Spinal case, it refers to the spinal column.
The Underscore case or Snake case
Convention: the words are in lower case and are linked by undescores (underscore: _).
Examples: my_variable_name, my_url
The underscore case, also called snake case, is used in PHP, Ruby or Phyton. There is a variant of this convention. Named screaming snake case, which consists in capitalizing all words, always separated by underscore (Example: MY_CONSTANT_NAME). This form is found in the names of constants in PHP or to name exceptions in ADA.
Programming conventions in WordPress
You can find the conventions and best practices of programming for the themes, the pluginsand the core WordPress documented in the codex.