# ElephantPHP > A technical publication about PHP internals, performance, architecture, and production behavior — measurements over assumptions, trade-offs over rules. - Language: en - 15 posts across 4 of the five categories below. - Every post is also served as plain Markdown at its URL with `.md` appended. - Who writes this, what does and does not get published, and the fixed measurement rig behind every number on the site: https://elephantphp.com/about/ - Full text of the archive in one document: https://elephantphp.com/llms-full.txt - Feed: https://elephantphp.com/rss.xml ## Categories - [Internals](https://elephantphp.com/category/internals/) — 10 posts — The engine: compilation, the Zend VM, memory layout, and the data structures behind the values you pass around. - [Performance](https://elephantphp.com/category/performance/) — 3 posts — Measurement: profiling, benchmark method, and optimization that arrives with a number attached. - [Architecture](https://elephantphp.com/category/architecture/) — 1 post — How an application is put together: boundaries, dependency injection, layering, and what a framework design costs later. - [Runtime](https://elephantphp.com/category/runtime/) — 1 post — Production behavior: PHP-FPM pools, worker processes, long-running runtimes, and where memory goes over a day. ## Series - [Values and memory](https://elephantphp.com/series/values-and-memory/) — 5 parts — What a PHP value is made of, what it costs to hold one, and when the engine decides to copy it. 1. [What a PHP variable actually is](https://elephantphp.com/blog/what-a-php-variable-actually-is/) 2. [A by-reference foreach leaves a reference in every element](https://elephantphp.com/blog/copy-on-write-and-the-cost-of-passing-arrays/) 3. [Two hundred thousand objects, and the collector never ran](https://elephantphp.com/blog/the-gc-only-collects-cycles/) 4. [A declared property is cheaper than an array key](https://elephantphp.com/blog/objects-are-cheaper-than-arrays/) 5. [Appending to a string is free until someone else holds it](https://elephantphp.com/blog/strings-in-php-interned-copies-and-concatenation/) - [Reading the engine](https://elephantphp.com/series/reading-the-engine/) — 2 parts — How to get opcodes out of PHP, what the dispatch loop does with them, and what the optimizer changed before either happened. 1. [Two tools printed different opcodes for one function](https://elephantphp.com/blog/reading-an-opcode-dump/) 2. [The opcode is not the handler](https://elephantphp.com/blog/how-the-zend-vm-dispatches-an-opcode/) ## Posts ### Internals - [The opcode is not the handler](https://elephantphp.com/blog/how-the-zend-vm-dispatches-an-opcode/) — 2026-10-25 — The same loop ran 23% faster with int parameters, and only with OPcache on. Operand classes pick a handler when the file compiles; proven types pick a different one. (Markdown: https://elephantphp.com/blog/how-the-zend-vm-dispatches-an-opcode.md) - [Two tools printed different opcodes for one function](https://elephantphp.com/blog/reading-an-opcode-dump/) — 2026-10-18 — phpdbg showed thirteen instructions and the optimizer showed nine. Both were right. How to read the notation, and which listing is the one that runs. (Markdown: https://elephantphp.com/blog/reading-an-opcode-dump.md) - [Appending to a string is free until someone else holds it](https://elephantphp.com/blog/strings-in-php-interned-copies-and-concatenation/) — 2026-10-11 — The same .= statement took 0.269 ms and 218.836 ms in two loops that differ by one assignment. What a zend_string costs, where literals live, and why implode is not the fix. (Markdown: https://elephantphp.com/blog/strings-in-php-interned-copies-and-concatenation.md) - [A property hook emits the same opcode as a plain property](https://elephantphp.com/blog/property-hooks-and-what-the-compiler-emits/) — 2026-10-04 — Plain, backed and virtual property reads compile to one identical FETCH_OBJ_R. What separates them is a function call the opcode does not show, measured at nine times. (Markdown: https://elephantphp.com/blog/property-hooks-and-what-the-compiler-emits.md) - [A declared property is cheaper than an array key](https://elephantphp.com/blog/objects-are-cheaper-than-arrays/) — 2026-09-27 — One hundred thousand four-field records cost 143.54 bytes each as objects and 397.14 as associative arrays. Where the crossover is, and what one undeclared property costs. (Markdown: https://elephantphp.com/blog/objects-are-cheaper-than-arrays.md) - [Two hundred thousand objects, and the collector never ran](https://elephantphp.com/blog/the-gc-only-collects-cycles/) — 2026-09-20 — Two hundred thousand objects created and dropped, and zero collections. What puts an object in the root buffer, and why the collector's cost is set by what you keep alive. (Markdown: https://elephantphp.com/blog/the-gc-only-collects-cycles.md) - [A by-reference foreach leaves a reference in every element](https://elephantphp.com/blog/copy-on-write-and-the-cost-of-passing-arrays/) — 2026-09-06 — Walking an array with foreach ($rows as &$row) wraps every element in a zend_reference. On a million integers that is 32 MB the loop never gives back. (Markdown: https://elephantphp.com/blog/copy-on-write-and-the-cost-of-passing-arrays.md) - [What a PHP variable actually is](https://elephantphp.com/blog/what-a-php-variable-actually-is/) — 2026-08-30 — A zval is sixteen bytes, a value union and a type tag. What that tag says decides whether an assignment copies anything, what a reference costs, and which variable pays. (Markdown: https://elephantphp.com/blog/what-a-php-variable-actually-is.md) - [PHP arrays are not arrays](https://elephantphp.com/blog/php-arrays-are-not-arrays/) — 2026-08-06 — One structure serves as list, dictionary and set. Packed and hashed layouts, what each costs in memory, and when a conversion happens. (Markdown: https://elephantphp.com/blog/php-arrays-are-not-arrays.md) - [What happens when PHP runs your code](https://elephantphp.com/blog/what-happens-when-php-runs-your-code/) — 2026-07-02 — A request walks from the SAPI to the Zend VM — lexing, compilation to opcodes, the OPcache lookup that skips both, and execution. (Markdown: https://elephantphp.com/blog/what-happens-when-php-runs-your-code.md) ### Performance - [Three numbers for one process, and memory_limit reads the middle one](https://elephantphp.com/blog/where-php-memory-actually-goes/) — 2026-09-13 — memory_get_usage(), memory_get_usage(true) and ps disagree about one process. What each counts, which one memory_limit reads, and why a one-megabyte string costs two. (Markdown: https://elephantphp.com/blog/where-php-memory-actually-goes.md) - [OPcache, the JIT, and where time actually goes](https://elephantphp.com/blog/opcache-jit-and-where-time-actually-goes/) — 2026-07-30 — OPcache removes compilation, not execution. The JIT reaches arithmetic-heavy code and little else. Where the remaining time lives. (Markdown: https://elephantphp.com/blog/opcache-jit-and-where-time-actually-goes.md) - [Benchmarking PHP without lying to yourself](https://elephantphp.com/blog/benchmarking-php-without-lying-to-yourself/) — 2026-07-16 — Microbenchmarks measure exactly what you tell them to, which is rarely what you meant. Method, noise, and the numbers worth reporting. (Markdown: https://elephantphp.com/blog/benchmarking-php-without-lying-to-yourself.md) ### Architecture - [What compiled DI containers actually buy you](https://elephantphp.com/blog/what-compiled-di-containers-actually-buy-you/) — 2026-08-13 — Container compilation moves reflection from request time to build time. What that removes, what it costs, and when it matters. (Markdown: https://elephantphp.com/blog/what-compiled-di-containers-actually-buy-you.md) ### Runtime - [PHP-FPM process management in production](https://elephantphp.com/blog/php-fpm-process-management-in-production/) — 2026-08-20 — pm static, dynamic and ondemand, the memory ceiling nothing enforces, and how to size a pool from measurements rather than guesses. (Markdown: https://elephantphp.com/blog/php-fpm-process-management-in-production.md) ## Pages - [About ElephantPHP](https://elephantphp.com/about/) — A publication about PHP internals, performance, architecture and production behavior, written by Alden Pike. - [Privacy Policy](https://elephantphp.com/privacy/) — What data this site processes, on what legal basis, for how long, and the rights you have over it under the GDPR. - [Cookie Policy](https://elephantphp.com/cookies/) — This site sets no cookies. The one thing it stores on your device is your theme choice, and why that needs no consent banner. - [Terms of Use](https://elephantphp.com/terms/) — The terms this site is published under, including how its articles and its code samples may be reused.