Serialize data into a compact format that can be unserialized by fb_compact_unserialize()

function fb_compact_serialize(
  mixed $thing,
): mixed;

In general produces smaller output compared to fb_serialize(). Largest savings are on arrays with sequential (or almost sequential) indexes, i.e. simple arrays like array($a, $b, $c). NOTE: unlike serialize(), does not preserve internal references, i.e. array(&$a, &$a) will become array($a, $a).


  • mixed $thing - What to serialize. Note that objects are not supported.


  • mixed - - Serialized data.