Post #3907050
2026-07-18 09:13 UTC
Tokei 0.2.0 introduces support for dividing one duration by another. The operation returns a DTO exposing the quotient and remainder, giving developers the flexibility to access the result either through its properties or by using array destructuring with asTuple()
#duration #localtime #php
https://bakame-php.github.io/tokei/
Replies (2)
-
@nyamsprod@phpc.social 2026-07-18 09:40
The Duration class also introduces a new modulo() method, complementing dividedInto() by providing an easy way to retrieve the remainder of a duration division. This is especially useful when dealing with circular ranges. #duration #localtime #php #circular-range https://bakame-php.github.io/tokei/
-
@timwolla@phpc.social 2026-07-18 12:38
@nyamsprod@phpc.social This gave me the idea to check if array destructuring works with ArrayAccess. It does. This would allow to support both the destructuring and the “named properties”-based access in an equally convenient way (i.e. without ->asTuple()). This might be an option for the native Duration class in 8.7 then 🤔