PHP Naming Convention > Variable Naming

camelCase

  • Begin with a lowercase e.g. id, name.
  • If multiple words: start it with the lowercase letter followed by an uppercase letter e.g. emailAddress, firstName
  • Avoid using underscore or dash
  • Avoid one-character variables e.g. a, b
  • Cannot start with a number
<?php
$emailAddress = 'John Doe';
?>

Contributors

xthiago farbodsaraf