Early previewThis guide is in development. Items tagged verify are still being checked against official docs.
nebx Learn
GitHub
Menu
Home/PHP/Performance
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)

Performance

How PHP runs, and what that means in practice.

Execution model

Source is compiled to opcodes and cached by OPcache; a JIT exists since PHP 8.0 and helps CPU-bound code more than typical web requests.

Memory

Reference counting frees most memory immediately; everything is released at the end of a request.

Concurrency

Concurrency through many worker processes (PHP-FPM); Fibers enable async libraries such as ReactPHP and AMPHP.

In practice

PHP 7 and 8 were major speed-ups over PHP 5. Bootstrapping the framework on every request is often the main cost; long-running servers remove it.

Compare with the other five languages →

Saved in this browser only. Part of From code to production (0/5).