PHP VARIABLE TYPES

PHP VARIABLE TYPES





PHP Variables are used to store data information in the middle of  a PHP program.

What should we know about the Variables?


  • All the Variables are using in PHP programs are denoted with the dollar sign($).
  • The Value of a Variable is the value of its  most recent assignment.
  • Variables are assigned with = operator, with variable on the left side and the expression to be evaluated on the right side. 
  • Variables can be declared before assignment but do not needed.
  • Variables do not have intrinsic types which a variable does not know whether it will be used store number or a string of characters. 
  • Variables used before they are assigned default values. 
  • PHP does good job automatically can convert types from one another when it is necessary.
  • PHP variables are perl-like. 

PHP DATATYPES

In PHP, there are total 8 datatypes as,

Integers- are the whole numbers without a decimal point like 4567
Doubles- are floating point numbers like 4.25
Booleans- Two possible values True or False
Null- It is a special type which has only one value, NULL.
Strings- are sequence of character like "Welome to PHP".
Arrays- are named and indexed the collection of other values.
Objects- are instance of programmers defined classes, which can be the package of other values and function specific to the class.
Resources- the special variable which holds reference of resources out of PHP like databases.



Comments

Popular posts from this blog

PHP BASICS