Igbinary Serialize is a Drop in Replacement for the Standard PHP Serializer
Igbinary is a drop in replacement for the standard PHP serializer. It stores PHP data structures in a compact binary form that is much faster to write and read than the time and space consuming textual representation used by serialize(). Savings are especially significant when using memcached and similar memory based storages for serialized data.
Serialize() and unserialize() are the default PHP functions for transferring data between PHP applications or to external services. JSON is also popular for this purpose. JSON however has a lot of disadvantages compared to PHP’s own serialization technique; it only supports a subset of the available data types and requires encoding/decoding on the other end (which adds additional CPU overhead).
igbinary_serialize() is a new PHP function that aims to offer a better alternative to the serialize() and unserialize() functions. It is a much more memory efficient, fast to write and read, and less restrictive in what type of data it can represent (in contrast to serialize()). It can even handle circular references within arrays or objects — something that was not possible with the older functions.
Igbinary_serialize() works by separating the data into small chunks and storing each chunk as its own igbinary object. This igbinary object then contains the information needed to reconstruct the original data. igbinary_serialize() also calls the __serialize() or __sleep() member function of the object being serialized to allow it to perform any last minute clean-up before being saved. This is done to prevent memory leaks or other issues if the object was not fully serialized on first save.