Marc Bennewitz wrote:
Personally I would like to have a more reasonable way in general. No
special case and no magic method.
So my proposal then would be to try to add a class cast operator (needs
an own RFC) and later to with this approach on var_export.
I've wondered if this would make sense before myself. But I think any
such mechanism would need explicit support from the class being casted
to, if the resulting internal object state is to make sense. stdClass
wouldn't have that support.