Serialization is the conversion of object states, arrays and simple variables into a String type to allow transmission and storage for later use or by another script. PHP provides the serialize() and unserialize() functions to deal with this but after experimenting with anonymous functions (also called closures) which I blogged about earlier, I found out that trying to serialize a closure threw an exception because anonymous functions are actually internal PHP Closure objects that have serialization disabled.
I thought - "there's a gap that needs to be filled", and set out to write my second class for phpclasses.org but after a quick google search I found this (Extending PHP 5.3 Closures with Serialization and Reflection), and I must say, I'm glad I'm not the one who wrote the code for this class. The code is complex and brilliant, check it out!
No comments:
Post a Comment