Sharing the CustomCast extension
| From: | Daniel Scherzer | Date: | Thu, 19 Sep 2024 01:43:19 +0000 |
| Subject: | Sharing the CustomCast extension | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-125627@lists.php.net to get a copy of this message | ||
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
[1] https://github.com/DanielEScherzer/CustomCast