PHP Data Types


PHP supports 8 data types such as Boolean, Integer, float, string, array, object, resource, null.

Integer

An integer is a non-fractional, whole number such as 1, 2, 3, 4, 88, 1000, 1374747. The range of integer is operating system specific. PHP integer data type used the 32-bit signed integer storage limit.

Real Number

It is also known as a floating number or floating-point number. It is not a whole number and has fractions such as 1.22, 2.45, 100.765, etc.

String

Also called character string, it consists of a series of characters such s "php".

Float

PHP float data type uses the 64-bit floating-point number storage format, the IEEE 754 double-precision standard.

Array

PHP array data type uses key-value pairs to manage array elements. PHP arrays are really associate arrays, maps or hash tables in other programming languages.

Resource

It represents an external resource like a file or a database connection.

Null

It represents the status of a variable in which no value is assigned the variable. The null type has only a literal value:'null'.

Boolean

A boolean is a true or false value.

Object

It stores an instance of a class.