What is variable? A variable is a representation of a value. Let's take for instance, A=40; the representation of 40 is A, so A is called the variable. For storing information, a variable can be called "containers". Rules for variable 1. Add a $ (dollar sign) in front or before the variable name. For example: $No_of_oranges 2. The PHP cannot begin with numerals; despite the fact of adding the dollar sign ($) in front of the variable name. The variable name must begin with alphabets or underscore sign(_). 3. The PHP variable may contain the following characters: Numerals: (0-9) Alphabets: (A-Z) or (a-z) Underscore: (_) 4. PHP variables are case sensitive. ie. $No_of_oranges and $NO_OF_ORANGES are different variable 5. Variable name can be any length long. Variable Types: 1. Scalar types: Boolean Integer Float String 2. Compound types: Object Array 3. Special types: Resource Null Let's take an example: <?php $string...
Get simplified lectures