What is PHP?
PHP is a recursive acronym: the letters stand for "PHP: Hypertext Preprocessor". It's a popular scripting language, free and open source, whose code runs on the server rather than in the visitor's browser. The server carries out your script and delivers only the finished result to the browser, in the form of plain HTML.
Why PHP?
You can run PHP almost anywhere: Windows, Linux, Unix and Mac OS X are all supported, and it pairs with the leading web servers, including Nginx, Apache and Microsoft IIS. On the data side, it can talk to many databases, MySQL, PostgreSQL and MongoDB among them. It also costs nothing (you can get it from php.net) and is easy for beginners to pick up.
What You Should Already Know
This tutorial assumes you already know the basics of HTML, CSS and JavaScript, so it's worth getting comfortable with those first.
What is a PHP File?
A PHP file is simply a file whose name ends in .php. Inside it you can mix plain text, HTML, CSS, JavaScript and PHP code. The PHP part runs on the server, and the browser receives the output as HTML.
What Can PHP Do?
PHP is what makes a page dynamic: it can build page content on the fly, collect the data people send through forms, and work with a database. It also handles creating and managing files on the server, sending and receiving cookies, restricting who can access what, and encrypting data. Its output isn't limited to HTML either, because it can produce images, PDF files and XML as well.
What is new in PHP 8?
Version 8 brought a long list of additions to the language. Performance gets a boost from the Just-In-Time (JIT) Compiler. Union Types let a value be one of several types, Named Arguments let you pass values by parameter name, and Match Expressions offer a better alternative to switch. There is also the Nullsafe Operator (?->), Attributes for attaching metadata to code, improved error handling, and new functions such as str_contains(), str_starts_with() and str_ends_with().