Tim Düsterhus and Derick Rethans have proposed a new `Time\Duration` class for PHP 8.6 to represent stopwatch-style durations, primarily to improve APIs that accept timeouts (such as the new Polling API). The class uses a seconds + nanoseconds internal representation, supports constructors up to hours, and includes `Duration::fromIso8601String`. The RFC is intentionally minimal to meet the PHP 8.6 feature freeze deadline. Community discussion covers design questions including: why the highest unit is seconds internally, missing ISO 8601 serialization, floating-point total methods, namespace choice (`Time` vs `DateTime`), whether to use `add`/`sub` vs a variadic `sum` method, and whether to adopt the JavaScript `temporal_rs` library instead of building a custom API.

1h 48m read timeFrom externals.io
Post cover image
217 Impressions