PHP has eight types of data types.It is mainly divided in two types
- scalar (single-value) types
- compound (collection) types
- special types
scalar (single-value) types:
It consists integers, floating-point numbers, strings, and booleans.
compound (collection) types:
It consists arrays and objects.
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.
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;