> If you take mutation off the table, then things become easier, IMO. We
> only need two magic methods:
> * __toInteger(): int
> * __toFloat(): float
> Then, in any mathematical context, PHP could call the appropriate
> method and use the number returned in the calculation.
I don't think this is enough to make operator overloading useful, even without mutation.
For example, the result of TimeInterval(1, 'ms') + TimeInterval(3, 'days') requires more information that we'd get out of __toInteger or __toFloat, but could still be a useful operation to perform, and ought to return a new TimeInterval (not an int). There are many of these tagged-number types where overloading would be helpful.