Convert a boolean into a string

Convert a boolean into a string

Convert a boolean into a string What could go wrong? I was recently spelunking through the Cornstack/nomic training dataset, the massive corpus of code that feeds some of our modern AI overlords, when I noticed something amusing. One of the queries in that dataset ask how to “convert a boolean to a string in PHP,” […]

When PHP Meet Unicode: A Tour of Identifiers Beyond ASCII

When PHP Meet Unicode: A Tour of Identifiers Beyond ASCII

When PHP Meet Unicode: A Tour of Identifiers Beyond ASCII Every year, like clockwork, someone rediscovers that a day is not reliably 86400 seconds long, gets righteously indignant about daylight change on Hacker News, and two hundred comments later the whole internet has relearned a lesson it relearns every March and October. PHP’s “you can […]

I Checked Every php.* Domain on the Internet

I Checked Every php.* Domain on the Internet

I Checked Every php.* Domain on the Internet There are 1,437 top-level domains recognized by IANA today, things like .com, .museum, .fr, and obscure ones such as .ismaili and .bugatti. I decided to find out how much of the internet’s php.* namespace has actually been claimed, checking php.<tld> against every single one of them and […]

__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 […]

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 […]