Skip to content

Instantly share code, notes, and snippets.

@409H
Created July 29, 2015 10:01
Show Gist options
  • Save 409H/f49d7ba78974405b6d67 to your computer and use it in GitHub Desktop.
Save 409H/f49d7ba78974405b6d67 to your computer and use it in GitHub Desktop.
Hungarian Notation (A flavour of...)

Hungarian notation is an identifier naming convention in computer programming, in which the name of a variable or function indicates its type or intended use. There are two types of Hungarian notation: Systems Hungarian notation and Apps Hungarian notation.

This flavour is simply prefixing the variable with 3 characters to quickly identify the data type of the variable. I find it's much easier to debug your code.


String Variables

$strFirstName = 'Harry'; 

Integer Variables

$intNumberOfPeople = 2;

Float Variables

$flPrice = 2.99;

Object Variables

$objClass = new \StdClass();

Resource Variables

$resCurl = curl_init();

Array Variables

$arrColours = array("red", "green", "blue");

Boolean Variables

$blSomething = TRUE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment