[EMAIL PROTECTED] wrote:

No. You need to remember that in most cases where you cast a variable from
one type to another, you will experience data (precision) loss. This is
also the case in converting an object to an array. Only the properties are
copied over (since functions can not be part of an array).


The point is interesting, but as far as I do not need to store class methods I think there's nothing lost between conversion. I'll store the name of the class of the instance, so the methods of the instance will be those of that class. I only need some manner to tell PHP that the object is an instance of "MyClass" (following the original example) to have the object exactly equal as it was before conversions.

Perl has a function to to that, that's called bless:
http://www.perldoc.com/perl5.6/pod/func/bless.html

FYI, the reason I need this is because I'm creating my own object's serialization routines.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to