What is PHP and where it runs

Содержание
What is PHP
Where PHP runs
Why learn PHP 8.5
Check your setup

What is PHP

PHP is a server-side scripting language built for the web. A visitor requests a page, PHP code runs on the server, and the server sends back plain HTML.

Unlike scripts in the browser, PHP never runs on the visitor's computer in a normal setup. It runs where your site lives: on the server.

$message = "Hello from the server!"; echo $message;

Where PHP runs

The same language runs in three places. Behind a web server it builds pages and APIs. In the terminal it runs scripts, tests, and maintenance jobs.

On your own machine the built-in web server is enough for learning. You will meet it in the next lesson.

echo PHP_SAPI; // cli or fpm-fcgi echo PHP_VERSION; // for example 8.5.0

Why learn PHP 8.5

Modern PHP is strict, fast, and typed. Each PHP 8 release added real types, faster execution, and cleaner syntax, and the full story lives in PHP versions.

Millions of sites run on PHP, from small blogs to large shops, so the first job or freelance order is never far away. Hosting, frameworks, and packages are everywhere.

function total(float $price, int $qty): float { return $price * $qty; } var_dump(total(9.5, 4)); // float(38)

Check your setup

You need two things for the next lesson: PHP 8.1 or newer and a terminal. Any code editor works, even a plain one without plugins.

if (version_compare(PHP_VERSION, "8.1.0", ">=")) { echo "Ready for the course!"; }

Next: Install PHP 8.5 and run your first command

Автор статьи: Arthur Isaev

Похожие статьи
Программирование на PHP
PHP course: zero to hero in 50 lessons
What is PHP and where it runs
Install PHP 8.5 and run your first command
Your first PHP script
Comments in PHP
Variables and constants
Types in PHP
Strings in PHP
Numbers in PHP
Operators
if and else
switch and match
Ternary, null coalescing and nullsafe
Loops
Arrays
Associative arrays
Functions
Variable scope
include and require
Namespaces
Composer and autoloading
Everyday string functions
Dates and time
JSON in PHP
Reading and writing files
Errors: read, reproduce, fix
Classes and objects
Constructors and promotion
Inheritance
Interfaces and traits
Enums
Magic methods
Attributes
Exceptions
Strict types
Closures and arrow functions
Generators with yield
Forms: GET and POST
HTTP: headers and status codes
Cookies
Sessions
Login with sessions
JSON REST endpoint
Database with PDO
Uploads and .htaccess
Lint like a pro
Clean functions
Debugging
Modern PHP tour: 5 to 8.4
PHP 8.5 for busy developers
Hero roadmap: the whole course on one page

Поиск по сайту

Канал @aofeed Чат @aofeedchat

Контакты и сотрудничество:
Рекомендую наш хостинг beget.ru
Пишите на info@urn.su если Вы:
1. Хотите написать статью для нашего сайта или перевести статью на свой родной язык.
2. Хотите разместить на сайте рекламу, подходящую по тематике.
3. Реклама на моём сайте имеет максимальный уровень цензуры. Если Вы увидели рекламный блок недопустимый для просмотра детьми школьного возраста, вызывающий шок или вводящий в заблуждение - пожалуйста свяжитесь с нами по электронной почте
4. Нашли на сайте ошибку, неточности, баг и т.д. ... .......
5. Статьи можно расшарить в соцсетях, нажав на иконку сети: