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:

  1. Integers: are whole numbers, without a decimal point, like 2567
  2. Doubles: are floating-point numbers, like 1.5 or 134.153
  3. Booleans: have only two possible values either true or false
  4. NULL: is a special type that only has one value: NULL
  5. Strings: is a sequence of characters, like “Hello PHP!”
  6. Arrays: stores multiple values in one single variable
  7. Objects: instances of user-defined classes
  8. Resources: are special variables that hold references to resources such as database call

Learn more about the similar topics?
  • No Content Found.
  • Interview Questions & Answers
    Exercises & Assignments
  • No Content Found.