Best Practice – Code styling and formatting

CSS

Hypens, lower case, example: .btn-green or #sidebar-right

JS

Variable and function names should be full words, using camel case with a lowercase first letter. 

Example: camelCase

PHP

Use lowercase letters in variable, action/filter, and function names (never camelCase). Separate words via underscores. Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

<?php 
function some_name( $some_variable ) {}

$my_array = array(
  'foo'   => 'somevalue',
  'foo2'  => 'somevalue2',
  'foo3'  => 'somevalue3',
  'foo34' => 'somevalue3',
);

$my_variable = 'something';

Query String

query string variable names should be underscore and lowercase eg utm_content=buy_now

query values can contain both hyphen and underscores eg utm_campaign=summer_sale-2022_12_01

v

Search the site


Address

123 Main Street
Town
City
P05T C0D3

Tel: 01234 567 899

Mob: 01234 567 899

Email: ben@gomopress.com


Copyright 2023. Blah blah blah Company Limited