Data types in PHP

PHP has eight types of data types.It is mainly divided in two types

  1. scalar (single-value) types
  2. compound (collection) types
  3. special types

scalar (single-value) types:

It consists integers, floating-point numbers, strings, and booleans.

compound (collection) types:

It consists arrays and objects.

special types:

Consists resource and NULL.

Let Us see one by one in details.



Are whole numbers like 1,2,3,4,5,6,7,8,9……..etc. Yhe range if accepated values is –2,147,483,648 to +2,147,483,647.It can be also written in decimal, octal, or hexadecimal.

Floating-Point Numbers

It is also called as real numbers. It represents numeric value in decimal digits. It allows  numbers between 1.7E–308 and 1.7E+308 with 15 digits of accuracy.

Example: 3.14, 26.11, etc.


PHP supports creating and manipulating strings.It is a sequence of characters.It is written in single or double quotes.

Example: ‘santosh’ , ‘gaurav’ etc.


It represents true or false state.In PHP, the following values are false:
• The keyword false
• The integer 0
• The floating-point value 0.0

• An array with zero elements
• An object with no values or functions
• The NULL value.


It holds a group of values, which you can identify by position.The number zero will be first position.


PHP also supports object-oriented programming (OOP).


The NULL value represents a variable that has no value

Example: $post = NULL;


Gaurav Sontakke on EmailGaurav Sontakke on FacebookGaurav Sontakke on Youtube
Gaurav Sontakke
Trainer at Orange Computer
My Self Gaurav Sontakke From Nanded having intrest from last 14 Yrs in RedHat Linux and Windows Server Configuration . Also in PHP MySql, Bootstrap, HTML, CSS, Javascript, Angular JS programming Language. is my official website.

Leave a Comment