PHP (PHP: Hypertext Preprocessor) is a programming language that runs on the server side. Unlike HTML or JavaScript, which run in the browser, PHP does its work on the server before the page reaches the visitor.
How it works
- The browser requests a page (for example index.php).
- The server runs the PHP code: it calculates, reads a database, and so on.
- The server sends back plain HTML to the browser.
The visitor never sees your PHP code: they only receive the result. That is why PHP is perfect for dynamic pages (content that changes depending on the user, the date, a database and so on).
A PHP file uses the .php extension and can mix HTML with PHP code wrapped in the <?php … ?> tags.
Key point: PHP runs on the server and produces HTML. The browser never receives the PHP source code.