PHP Code Standards: Difference between revisions

From PM Wiki
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Popular Marketing Code Standards =
= Variable Naming Conventions =


== Variable Naming Conventions ==
== Local Variables ==


=== Local Variables ===
Local variable names should all be lower case: <pre>$email</pre>


Local variable names should all be lower case, ex. <pre>email</pre>
If the local variable name is made up of multiple words, use snake case: <pre>$email_address</pre>


If the local variable name is made up of multiple words, use snake case, ex. <pre>email_address</pre>
== Functions ==


=== Functions ===
Function names should all be lowercase: <pre>update</pre>


Function names should all be lowercase, ex. <pre>update</pre>
If the function name is made up of multiple words, use snake case: <pre>update_by_id</pre>


If the function name is made up of multiple words, use snake case, ex. <pre>update_by_id</pre>
== Classes ==


=== Classes ===
Class names should all be capitalized: <pre>Vertical</pre>


Class names should all be capitalized, ex. <pre>Vertical</pre>
If the class name is made up of multiple words, use Pascal case: <pre>VerticalGroup</pre>
 
If the class name is made up of multiple words, use snake case, but preserving the first word capitalization, ex. <pre>Vertical_groups</pre>

Latest revision as of 17:19, 26 October 2022

Variable Naming Conventions

Local Variables

Local variable names should all be lower case:

$email

If the local variable name is made up of multiple words, use snake case:

$email_address

Functions

Function names should all be lowercase:

update

If the function name is made up of multiple words, use snake case:

update_by_id

Classes

Class names should all be capitalized:

Vertical

If the class name is made up of multiple words, use Pascal case:

VerticalGroup