PHP
A programming language used mainly to build the server side of websites and web apps. It can read from a database, apply business rules, and send back a web page or data such as JSON.
What PHP does
Think of a product page: the browser asks for it, but it doesn't know the current price or stock level. A PHP application can look up those details and generate the HTML the browser displays. The same application might send JSON instead when the caller is a mobile app. Either way, the server runs the PHP code and the client sees only the response.
How a request reaches PHP
In a common production setup, Nginx serves static assets such as images directly and forwards requests that need PHP to PHP-FPM over FastCGI. PHP-FPM manages a pool of worker processes. A worker runs the application code for a request, and Nginx sends the response to the client. Workers can handle successive requests, but ordinary PHP variables in a request do not survive into the next one. To keep something like a shopping cart across requests, use a session or store the data outside the request, for example in a database.
Example: returning JSON
<?php
header('Content-Type: application/json');
echo json_encode(['inStock' => true]);
header() tells the client how to interpret the body. json_encode() converts the PHP associative array to {"inStock":true}, and echo writes it to the response. In a web framework, you'd typically return a response object and let the framework handle the headers and encoding.
Where PHP fits
WordPress is a content management system built with PHP. Laravel and Symfony are frameworks for building applications, with tools for tasks such as matching a URL to the code that handles it. Neither a framework nor a web server is required to run the language: the PHP command-line interface can run maintenance scripts and background jobs.
Common interview topics
PHP is dynamically typed, even though it supports type declarations for parameters, return values, and properties. A variable can hold an integer now and a string later. Declarations still matter: PHP checks them at runtime. For scalar parameter types, declare(strict_types=1) in the calling file turns off most implicit conversions at the call boundary; it doesn't make the whole application statically typed or validate incoming HTTP data.
Interviewers also ask why '7' == 7 is true but '7' === 7 is false. Loose equality can convert values before comparing them, while strict equality does not. This comes up with query parameters: an ID may arrive as the string '7', even if your application uses integer IDs. Validate and convert the input explicitly before relying on a strict comparison.