Hi Internals,
I wanted to share the “CustomCast” extension[1] that I wrote over the summer. I originally wrote it as just a learning exercise for me to get familiar with PHP internals, but given some recent discussions (particularly around operator overloads) I figured it might be useful for others.
Basically, the extension allows a class to control how it should be treated when cast to a boolean, integer, or float.
If this extension is useful to others, I can look into getting it published on PECL.
Thanks,
–Daniel Scherzer