What is Datatypes,Variable and Constants using in PHP ?

A variable is a container that stores variable data, such as number,character, and date. PHP provides data types that specifies type of values of the variable can contain. For example ,a data type defines that a variable (number) can contain only numbers.The DATA TYPES that PHP supports are:  

  1. Integer : It represents whole numbers.In PHP integer variables can store values between -2,147,483,648 and +2,147,483,648. For example, in int$a=5, $a is an integer variable  that is assigned with the value, 5.  
  2. Float : It stores decimal values. PHP lets you store floating numbers in both normal and scientific notation .Scientific notation is a shorthand way of writing very large or very small numbers.A number expressed as a decimal number between 1 and 10.For example in float $a=5. 2E2 ,$a is a multiplied by a power of 10.For example $a is a float variable created using scientific notation and contains the value 520.
  3. Boolean : It stores the values ,TRUE or FALSE. for example in $a=true, $a is a Boolean variable that is assigned the value,TRUE.  
  4. String : It stores string information enclosed within the double quotes,For example  in $a=”Angela Jones” ,$a represents a STRING variable that contains the string ‘Angela Jones’.

      5. Array : It stores elements in the form of key/value pairs.The key values      start with ZERO.

     6. Object : It stores data and provides functions to process the data.

     7. Resume : It stores reference to functions or other resources external to PHP.

      8. Null : It represents an undefined value.


Categories: PHP

Leave a Reply

Your email address will not be published. Required fields are marked *