You are here: Daniel Dumas » Blog, PHP »

PHP and MySQL Basics: Variables

PHP and MySQL Basics: Variables

Variables are the building blocks of any programming language. in PHP variables are very important, it used to store numeric or non-numeric datas. PHP supports different types of variable types (Booleans, Integers, Floating point numbers, Strings, Arrays, Objects, resources and nulls.

PHP VARIABLE NAMING RULES:

  1. PHP variables starts with a $ sign : example. $daniel
  2. $ sign is followed by a letter or an underscore. thus $123 is not a valid PHP variable.
  3. it can contain letters, numbers, underscores or even dashes.
  4. no spaces
  5. PHP variables are CASE-SENSITIVE thus $daniel and $DANIEL are completely different variable.

EXAMPLES OF VALID PHP VARIABLES

$dan
$Daniel
$myVariable – Camel case style
$my_variable
$my-variable
$item1
$_note
$__noteBook

Discussion

Leave the First Comment Here





CommentLuv badge