What are the main data types in PHP?

Beginner

Answer

PHP supports several data types grouped into three categories:

  • Scalar types: boolean, integer, float/double, string
  • Compound types: array, object, callable, iterable
  • Special types: resource, NULL

PHP is dynamically typed, meaning variables don't need explicit type declaration and can change types during execution.