🐘 PHP Beginner

What are PHP data types?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid PHP basics — a prerequisite for any developer role.

Answer

PHP supports eight primitive data types. Scalar types: int (whole numbers), float (decimal numbers), string (sequence of characters), bool (true or false). Compound types: array (ordered map that can hold multiple values of any type), object (instance of a class). Special types: null (variable has no value), resource (reference to an external resource like a file handle or database connection). PHP is a loosely typed (dynamically typed) language — a variable can hold any type and can change type during execution, though PHP 7+ added strict type declarations.

Pro Tip

Back up your answer with a specific project or situation. Saying 'In my last PHP project, I used this when...' immediately makes your answer more credible and memorable.