This RFC covers a way to cast classes to scalar values other than strings.
Currently the Zend Engine provides some magic to methods in classes with defined names, for example __toString() is called when someone attempts to cast a class to a string.
The purpose of this RFC is to propose a way to allow casting to other scalar types (boolean, double, integer).
For the same reasons as __toString() exists, casting to other types might be needed. Feature requests have been submitted regarding this in the past.
Currently two possibilities exists:
Concern has been raised over the fact of passing the requested value type as parameter to the function, as it could be used to disallow some kinds of cast.
2008-11-24: Initial draft