What are the different data types in PHP?
PHP data type is an attribute that tells about the type of data needs to be stored. There are 8 data types in PHP:
- Integers: are whole numbers, without a decimal point, like 2567
- Doubles: are floating-point numbers, like 1.5 or 134.153
- Booleans: have only two possible values either true or false
- NULL: is a special type that only has one value: NULL
- Strings: is a sequence of characters, like “Hello PHP!”
- Arrays: stores multiple values in one single variable
- Objects: instances of user-defined classes
- Resources: are special variables that hold references to resources such as database call
Learn more about the similar topics?
Interview Questions & Answers
Exercises & Assignments