__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 […]
There and Back Again: Round-Trip Testing in PHP Most of the work in a unit test is not calling the function. It is knowing what the function is supposed to return. You call it, you get a value, and now you type the expected value by hand and pray you did the arithmetic in your […]
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, […]
flock() is a Suggestion, Not a Law I spend a fair amount of my professional life staring at static analysis reports for a living, and every so often a rule reminds me that I’ve been trusting a piece of the standard library a little too much. This week it was flock(). The original question was: […]
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 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 [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 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 […]
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) 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 […]
Putting PHP’s M_EULER to Work PHP ships with more mathematical constants than most developers ever use. One of the most overlooked is M_EULER, which is the Euler constant. So, before putting PHP’s M_EULER to work, we need to clear up a confusion with another Euler constant in PHP: M_E. M_E vs M_EULER: Two Constants, Two […]











