Early previewThis guide is in development. Items tagged verify are still being checked against official docs.
nebx Learn
GitHub
Menu
Home/PHP/Basics
PHP

PHP

Pragmatic server-side language that powers a large share of the web.

Paradigm
OOP, procedural, functional features
Typing
Dynamic with gradual typing (strict_types)
Memory
Reference counting + cycle collector
Runs
Zend Engine, bytecode + OPcache, optional JIT
Concurrency
Shared-nothing per request; Fibers (8.1)

Basics

The concepts you need before patterns make sense in PHP.

Request lifecycle

Classic PHP starts fresh for every request: load code, handle the request, discard all state. This shared-nothing model makes scaling simple.

<?php
declare(strict_types=1);

echo "Hello, patterns!\n";

Composer and PSR-4 autoloading

Composer installs packages and generates an autoloader that maps namespaces to folders.

Types

Scalar, union, nullable, intersection and never types. declare(strict_types=1) stops silent coercion.

Classes, interfaces, traits

Single inheritance plus traits for horizontal code reuse; abstract classes and interfaces for contracts.

Modern features verify

Enums and readonly properties (8.1), readonly classes (8.2), property hooks (8.4).

Saved in this browser only. Part of Clean code foundations (0/5).