Voting

: nine plus zero?
(Example: nine)

The Note You're Voting On

olliejones at gmail dot com
2 months ago
This little function returns true if a data string was made by igbinary_serialize() and can be passed to igbinary_unseriaize().

function is_igbinary($data) {
return is_string($data) && '00000002' === bin2hex(substr($data, 0, 4));
}

It doesn't validate the contents of the data string, or ensure it is safe to decode if it came from an untrusted source. But it is handy when trying to avoid unserializing data that wasn't serialized.

<< Back to user notes page

To Top