Course Banner

PHP Variables

A variable is a medium for storing a value, like textor integer.And the same variable can be used throughout your code, instead of rather than typing out the actual value over and over again Variables in PHP start with dollar sign and then the name of the variable. Remember, the variable name is case-sensitive.

PHP Variable Naming Convention:

  • 1. It cannot have space
  • 2. Two or more words can be combined through underscore such as my_home
  • 3. Variable name cannot start with numbers and special characters.

Example :

  1. $hello = "I am learning PHP";
  2. $a_number = 78;
  3. $anotherNumber = 18;
  4. ?>