Yes, like that, only better. Since automatic type casting is central in
PHP, as this is evident after all this discussion, I believe that it should
be better supported. There are two thinks that I would like to see here:

1. No more magic methods, please.
2. It should cover (eventually) casting to and from any type.

:-)

Lazare INEPOLOGLOU
Ingénieur Logiciel


2012/3/9 Anthony Ferrara <ircmax...@gmail.com>

> > (Now, it would be nice to have another RFC about custom object casting to
> > int, float and bool...)
>
> You mean like https://wiki.php.net/rfc/object_cast_to_types which is
> still in draft?
>
> Note that __toBool would be problematic, since it would be called if
> the object was used in an if statement, which could yield some very
> strange results if it returned false (it would break the existing
> semantics about how we can use if statements to determine if the type
> is populated)...
>
> Anthony
>

Reply via email to