We should follow best practices accepted by the community. As mentioned in php the right way, PHP-FIG, the PHP Framework Interop Group, announced PSR.
We decided to follow PSR-2.
Starting from PHP 5.3, you can use ?: to simplify ternary operations. The two following statements are the same:
$otherVariable = $variable ?: $someVariable;
$otherVariable = $variable ? $variable : $someVariable;Please read Global Styles for additional guidelines regarding operators
We use camelCase for variable names. The first letter should be lowercase.
No:
$variable_nameNo:
$VariableNameYes:
$variableNamePlease read Template Guidelines