HomebaseWorks

PHP interview questions for junior developers

What interviewers ask about PHP fundamentals and web security, answered briefly.

EWritten by the HomebaseWorks editorial team · reviewed 26 Oct 2026
1
What is the difference between == and ===?

== converts types before comparing, so '1' == 1 is true. === compares type and value. Use === by default.

2
How do you prevent SQL injection?

Prepared statements with bound parameters through PDO or MySQLi. Never build a query by concatenating user input.

3
How do you prevent XSS?

Escape output with htmlspecialchars whenever user-supplied text goes into HTML. Validate input too, but escaping output is the control that works.

Advertisement
4
What are $_GET, $_POST and $_SESSION?

Superglobals: query-string parameters, POST body fields, and per-user data kept across requests after session_start().

5
What does isset() return for a null variable?

false. isset is true only for a variable that exists and is not null. array_key_exists checks a key regardless of value.

6
What is Composer?

PHP's dependency manager. composer.json lists packages and autoload rules; composer.lock pins versions; vendor/autoload.php loads classes.

Practise out loud. Say each answer once as written, then again in your own words with your own number or story.

Have a number ready. "My PHP score is at benchmark on a timed test" is a stronger answer than "I am good at it". Take the test and quote the result.

Advertisement
Continue with PHP4 lessons · 2 interview sets · 1 test · 1 certificate
Not tested

More in Programming