filmov
tv
How to declare variables in PHP with rules and getting type of variables using gettype()

Показать описание
04:29 gettype() , getting the type of variable
07:34 undefined variables in PHP
Declaring variables in PHP
Start with $
Next char after $ ( starting ) must be a letter or underscore ( numbers are not allowed )
Only alphabet, number and underscore are allowed ( no space )
Variable names are case-sensitive
Should start with $
$var1=‘testing’; // correct
Var1=‘testing’; // wrong
_var1=‘testing’; // wrong
5var=‘testing’ // wrong
After $ We can’t use number
$_var1=‘testing’; // correct
$1var=‘testing’; // wrong
$var1=‘testing’; // wrong
gettype() : Type of the variable
Type of Variables in PHP
1. Boolean : True False ( two values only )
2. Integer : whole numbers like 5 , 356
3. Double : with decimal numbers like 5.6, 2. , 3.89
4. String : "plus2net"
5. Array : Keep multiple variables in an array
6. Object : Used to access classes Example : Database connection object
7. Resource : Holding reference to external resources
8. NULL : Special variable , represents no value
Download the source code from here
#PHPVariables #variables #PHP #gettype() #undefinedVariables #VariableType #plus2net
07:34 undefined variables in PHP
Declaring variables in PHP
Start with $
Next char after $ ( starting ) must be a letter or underscore ( numbers are not allowed )
Only alphabet, number and underscore are allowed ( no space )
Variable names are case-sensitive
Should start with $
$var1=‘testing’; // correct
Var1=‘testing’; // wrong
_var1=‘testing’; // wrong
5var=‘testing’ // wrong
After $ We can’t use number
$_var1=‘testing’; // correct
$1var=‘testing’; // wrong
$var1=‘testing’; // wrong
gettype() : Type of the variable
Type of Variables in PHP
1. Boolean : True False ( two values only )
2. Integer : whole numbers like 5 , 356
3. Double : with decimal numbers like 5.6, 2. , 3.89
4. String : "plus2net"
5. Array : Keep multiple variables in an array
6. Object : Used to access classes Example : Database connection object
7. Resource : Holding reference to external resources
8. NULL : Special variable , represents no value
Download the source code from here
#PHPVariables #variables #PHP #gettype() #undefinedVariables #VariableType #plus2net