PHP interview questions for junior developers
What interviewers ask about PHP fundamentals and web security, answered briefly.
== converts types before comparing, so '1' == 1 is true. === compares type and value. Use === by default.
Prepared statements with bound parameters through PDO or MySQLi. Never build a query by concatenating user input.
Escape output with htmlspecialchars whenever user-supplied text goes into HTML. Validate input too, but escaping output is the control that works.
Superglobals: query-string parameters, POST body fields, and per-user data kept across requests after session_start().
false. isset is true only for a variable that exists and is not null. array_key_exists checks a key regardless of value.
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.
More in Programming