PHP is a general-purpose scripting language with first-class web support. It powers WordPress, Laravel, Symfony, Drupal, and a large share of hosted websites—especially on shared LAMP/LEMP hosting where deploy is upload-and-go.
Core characteristics
- Interpreted at request time — the server reads
.phpfiles and executes them per request (with opcode caches like OPcache in production) - Embeds in HTML — or, in modern apps, returns JSON from API routes
- Large standard library — strings, arrays, file I/O, HTTP, PDO, sessions built in
- Package ecosystem — Composer and Packagist for reusable libraries
Typical request flow
- Browser requests
/products.php?id=5 - Web server (Apache/Nginx) hands the script to PHP
- PHP reads
$_GET['id'], queries the database, builds HTML - Response travels back to the browser
Important interview questions and answers
- Q: Is PHP compiled or interpreted?
A: Source is interpreted per request, though OPcache stores compiled bytecode in memory for speed—think "interpreted with caching," not ahead-of-time compilation like Go. - Q: What is PHP mainly used for?
A: Server-side web development—dynamic pages, REST APIs, CMS themes/plugins, and full frameworks like Laravel. - Q: Is PHP still relevant?
A: Yes—massive existing codebase, WordPress/Laravel hiring demand, cheap hosting, and steady language improvements (typed properties, enums, fibers, JIT in some workloads).
Self-check
- Name two products or frameworks built on PHP.
- What file extension do PHP scripts typically use?
Interview prep
- What powers WordPress and Laravel?
Both are built on PHP—WordPress as a CMS platform and Laravel as a modern full-stack framework with routing, ORM, and ecosystem tooling.