PHP theorytheory 0/50 · 0%
Fundamentals · easy

3. Data Types

PHP's scalar and compound types.

PHP has scalar types (int, float, string, bool), compound types (array, object, callable, iterable), and special types (null, resource). Type juggling automatically converts values as needed in expressions.

Since PHP 7, scalar type declarations and return types can be added to function signatures for stricter contracts.

Check your understanding

  1. 1. Which is a scalar type in PHP?

  2. 2. What does gettype(3.14) return?