Uses of serialize() in php.its advantages and dis advantages
Advantages:
Turns objects into a string
Disadvantages:
Turns objects into a string
Disadvantages
- Resources are not serialized, and have to be manually recreated when unserialized
- Implementation has a number of open bugs
Advantages
PHP provides magic methods allowing you to handle this disadvantage
I dont see any disadvantage of serialization.
Advantage is that you can serialize objects and arrays and save them (for example in database). Later, you can get objects back (unserialize) in the exactly same state, in which they were saved.
http://us2.php.net/manual/en/function.serialize.php
It turns the object or array passed to it as the first (and only) argument to a string. This function is useful for storing objects in a database or file, for example. To turn the string back into an object or array, use unserialize(). Also look at the documentation of the function at: http://us2.php.net/manual/en/function.serialize.php
Only disadvantage is with utf8 encoding!
精彩评论