Re: [RFC] Four Pragmatic Directions for PHP: Simplicity, Arrays, Performance, Concurrency
| From: | Rob Landers | Date: | Thu, 26 Mar 2026 07:51:31 +0000 |
| Subject: | Re: [RFC] Four Pragmatic Directions for PHP: Simplicity, Arrays, Performance, Concurrency | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130458@lists.php.net to get a copy of this message | ||
I used to have a really long and interesting blog post on PHP arrays about this:
On Tue, Mar 24, 2026, at 12:04, Dan Liebner wrote:
> I agree with this sentiment.
>
> My main gripe with PHP 8 is that undefined array key accesses trigger a warning. There is no
> solution to this that doesn't require destroying the readability of a legacy codebase or using
> some hacky global error handler.
>
> I think the direction should always have been this: undefined array key accesses should simply
> return null by default.
And then my disk caught on fire and it was never archived. TL;DR: treating PHP arrays as an infinite
field of nulls has some very interesting mathematical properties. No other language on earth gave
you this.
Practical usecases were ways to effectively "cheat" on some np-hard and np-complete
problems, like subset-sum, knapsack, Hamiltonian Path, etc. This warning (and eventual removal of
this property) makes these "cheats" no longer possible in PHP and constrained just like
every other language on the planet.
— Rob