Scalar data types in php

In php four data types

  1. Boolean
  2. Integer
  3. Float
  4. String
Boolean data type in php

This data type can represent either true or false . In PHP value is 1 and value of false doesn’t any value.
is_bool : Using this function , we can check input variable is boolean or not.
(bool) var  OR  (boolean) var     using this function , we  convert variable into boolean variable.

Integer data type in php

This data type can store numeric value
is_int  OR  is_integer    it is used to  cheak input variable is integer or not .
(int)var ))OR  (integer) var  OR intval(var)    Using this function , we convert variable into integer variable.

Float data type in photo

this  data type  can store decimal values .

is_float ()  this function cheacks input variuable  is float or not.
(float)var   Converts a variable into floating point number.

String data type in php

It is a collection of character.
In PHP , we can declar string in  three ways.

  1.    By using single quotations
  2.    By using double quotations
  3.    By using heredoc syntax

NOTE  Variable in double quotations returns value of variables.

Heredoc   PHP suports heredoc  syntax to avoid the conflicts what we getting with single and double quotations.


Compound data types

Read more