__FILE__: The Magic Constant With Specific Usage

__FILE__: The Magic Constant With Specific Usage

 __FILE__: The Magic Constant With Specific Usage Every older PHP developer has meet __FILE__ early, usually while copy-pasting a WordPress plugin header from a tutorial written in 2009. There are lots of blogs posts documenting it: it is also quite famous outside the PHP universe. Nowadays, however useful is this magic constant, it seems it […]

Constant Scalar Expressions In PHP

Constant Scalar Expressions In PHP

Constant Scalar Expressions In PHP Constants are the immovable rocks of a PHP application. Once defined, they never change. Yet, since PHP 5.6, those rocks may be carved with expressions. This is the realm of constant scalar expressions, where PHP allows a little bit of calculation in a place that was, for a long time, […]

Hidden Traps with Chained Assignments

Hidden Traps with Chained Assignments

Hidden Traps with Chained Assignments If you’ve been writing PHP for a while, you’ve almost certainly written a few chained assignments yourself. It’s that neat, concise trick where you initialize multiple variables or properties on a single line: It looks clean. It feels efficient. It’s the kind of line that makes you feel, for one […]

When Generators Actually Makes Sense

When Generators Actually Makes Sense Generators are one of PHP 8 best-loved features. Sprinkle a yield into a function and suddenly you’re processing millions of rows with constant memory. At least, that’s the promise. The reality is more nuanced: lazy evaluation only pays off when the underlying data source can produce records incrementally. If the […]

Method Fossilisation in 2026

Method Fossilisation in 2026 [This is an updated version of this article ‘Method fossilisation’] Method fossilisation happens when methods get harder to update, due to sprawling overwriting. It is a process, more than a final state. In particular, it happens to methods when the signature is shared across multiple classes, via inheritance and interfaces. As […]

Using a vector database with PHP

Using a vector database with PHP

Using a vector database with PHP PHP has roughly 80 array functions: eight – zero. array_map, array_walk, array_reduce,array_filter, array_each… wait, that last one was deprecated and removed in PHP 7.2. Or not? And some new functions came up in PHP 8.5, last november. The real problem is discoverability. You know the task, “find the first […]

PHP Types and Tests: Not Rivals, Just Working Different Shifts

Types and tests

Types and Tests: Not Rivals, Just Working Different Shifts A common source of confusion in PHP development is the relationship between static analysis and unit testing. Are they redundant? Does adding types mean fewer tests? Does a comprehensive test suite make a type checker unnecessary? No to all three. They cover different grounds. The interesting […]

php-typos: a fast spellchecker for PHP codebases (Tool Review)

php-typos: A Fast Spellchecker for PHP Codebases (Tool Review) There’s a particular kind of embarrassment reserved for the typo that ships to production. A recievePayment() method. A config key spelled treshold. A comment that confidently explains the “lenght” of an array. None of it breaks anything, all of it makes the codebase look a little […]