Glossary
Web Developer Dictionary
Визначення технічних термінів з PHP, DevOps, MySQL та AI — з прикладами коду та поясненнями простою мовою.
228
terms
27
letters
U
Union and Intersection Types
Union types (PHP 8.0) let you declare that a parameter or return value can be one of several types. Intersection types (PHP 8.1) require the value to implement all listed interfaces simultaneously.
Union Types
function parse(string|int $id): User|null {
return User::find($id);
}
// PHP 8.0 also added: int|string, float|int, etc.
// Special types: mixed, never, void
Intersection Types
interface Serializable {}
interface Loggable {}
function process(Serializable&Loggable $obj): void {
// $obj is guaranteed to implement both interfaces
}
DNF Types (PHP 8.2)
Disjunctive Normal Form — combining union and intersection: (Serializable&Loggable)|null.
Unit Testing
A unit test is an automated test that verifies the smallest isolated unit of code (a function or method) in isolation from external dependencies. Runs fast and pinpoints the problem precisely.Properties of a good unit test (FIRST)Fast — runs in millisecondsIndependent — does not depend on other testsRepeatable — same result every timeSelf-validating — automatically determines pass/failTimely — written alongside the code, not afterAAA pattern// Arrange
$calc = new Calculator();
// Act
$result = $calc->add(2, 3);
// Assert
assertEquals(5, $result);Mocks and stubsTo isolate from DB, API, filesystem: mock (a fake with call verification) and stub (returns preset data, no verification). Popular libraries: PHPUnit, Jest, pytest.
Unix Timestamp
A Unix timestamp is the number of seconds elapsed since 1 January 1970 00:00:00 UTC. A universal, timezone-independent format for storing and transmitting moments in time.
Why it is convenient
One number instead of a complex object — easy to compare, store, pass through APIs
Timezone-independent — convert to local time on the client
Date arithmetic becomes integer arithmetic: difference in seconds, add 1 day = +86400
PHP
time(); // current Unix timestamp
strtotime('2025-01-01'); // string → timestamp
date('Y-m-d', 1735689600); // timestamp → string
// Carbon (recommended)
Carbon::now()->timestamp;
Carbon::createFromTimestamp(1735689600)->toDateString();
The Year 2038 problem
A 32-bit signed integer overflows on 19 January 2038 at 03:14:07 UTC. In PHP with 64-bit integers — no problem. But in old databases with a TIMESTAMP column (32-bit) — there is one.
UUID
UUID (Universally Unique Identifier) is a 128-bit identifier with an astronomically low probability of collision. It looks like 550e8400-e29b-41d4-a716-446655440000. It replaces sequential numeric IDs where they are insecure or inconvenient.Why instead of a numeric IDDoes not reveal the number of records in a table (/users/1 vs /users/550e8400-…)Can be generated on the client or in a distributed system without a DB round-tripNo conflicts when merging data from multiple databasesVersionsUUID v4 — fully random. Most commonUUID v7 — includes a timestamp, so it sorts chronologically. Better for DB primary keys (less index fragmentation)DrawbackUUID v4 as an InnoDB primary key causes B-Tree index fragmentation due to random insert order. UUID v7 or ULID solve this problem.