PHP Data Types

Facebooktwitterredditpinterestlinkedinmailby feather

PHP data type is used to hold the various types of data or value.  There are three types of data types in PHP.

It is a loosely data typed language, so there is no need to declare data type like int,float etc.

InPHP,there are some function to check data type and its value.

  • gettype(): It is used to check only data type.
  • var_dump(): It is used to check the size and data type.



60 is: integer

1000.56 is: double

PHP is: string



int(100) string(9) “Hello PHP” float(3.4)

Example of Array:


array(3) { [0]=> string(3) “You” [1]=> string(3) “Are” [2]=> string(14) “Good_Developer” }

Example of Object.






Example: 6

Note: It is used in database.

Following are the predefine functions to Check data type

Predefine Data type Description
is_int( ) To check the value is integer or not.
is_float( ) To check the value is float or not.
is_numeric( ) To check the value is either integer or float.
is_string( ) To check the value is string or not.
is_bool( ) To check the value is Boolean or not.
is_object( ) To check the value is object or not.
is_null( ) To check the value is null or not.
Facebooktwitterredditpinterestlinkedinmailby feather

Leave a Comment