Re: [PHP-DEV] [RFC] Duration class

[email protected] (Tim Düsterhus) Fri, 17 Jul 2026 17:20:46 +0200
Newsgroups php.internals
Message-ID <[email protected]>
Hi

On 7/17/26 16:01, Holly Schilling wrote:
> If we can get Structs and Duration to both land in PHP 9, I’d love to see Duration benefit from them.

I do not consider it a good idea to delay improvements to PHP’s standard 
library to wait for something that has not even left the Draft phase and 
thus will take an unknown *duration* to land - if it ever happens. I 
believe that improvements to the standard library are the single most 
impactful thing we can do to improve PHP and we’ve done a great job in 
the recent versions in doing so (e.g. with the new URI extension).

Value-based structs also do not bring significant improvements over what 
we can already do with `final` and `readonly` classes. In fact, it would 
likely be possible to just convert final readonly classes to value-based 
structs with only very minor breaking changes if there is a desire to do so.

It's also unclear to me why this would be something that needs to wait 
for PHP 9.

Best regards
Tim Düsterhus

PS: Please take care of threading, your initial email regarding your 
proposal was in reply to Pierre's email regarding the `fromSeconds()` 
constructor, which was incredibly confusing. See the thread view at 
https://news-web.php.net/php.internals/131989.