Fundamentals for PHPs
Fundamentals are the core syntax of PHP: variables beginning with a dollar sign, scalar types, operators, conditionals, loops and functions. PHP is dynamically typed, but type declarations and strict_types let you catch mistakes early. Code lives inside php tags and runs top to bottom on every request.
Stage: Language Basics · Part of the PHP roadmap · Last reviewed 19 November 2026
What to learn in Fundamentals
- Declare variables and tell integers, floats, strings and booleans apart
- Use if, match and switch to branch on values
- Write loops with for, foreach and while
- Define functions with typed parameters, return types and default values
- Enable strict_types and explain how it changes type coercion
Fundamentals interview questions
What is the difference between == and === in PHP?
The double equals operator compares values after type juggling, so 0 == "a" behaved surprisingly in older versions. Triple equals compares both value and type with no conversion. Prefer === to avoid hidden bugs.
How does the match expression differ from switch in PHP 8?
match returns a value, uses strict comparison, needs no break statements and throws UnhandledMatchError if no arm fits. switch uses loose comparison and falls through, which is easier to misuse. match is shorter and safer for mapping values.
Where Fundamentals fits in the PHP roadmap
Fundamentals belongs to the Language Basics stage (beginner level), which takes about 19 hours. Syntax and data.