PHP Data Types

PHP data types are used to hold different types of data or values. PHP supports 8 primitive data types that can be categorized further in 3 types:

  • Scalar Types
  • Compound Types
  • Special Types

PHP supports ten primitive types.

Four scalar types:

  • boolean
  • integer
  • float (floating-point number, aka double)
  • string

Four compound types:

  • array
  • object
  • callable
  • iterable

Two special types:

  • resource
  • NULL

PHP supports the following data types:

  • String
  • Integer
  • Float (floating point numbers - also called double)
  • Boolean
  • Array
  • Object
  • NULL
  • Resource