It’s a serialized string. Here’s a good description of what it is:
A PHP array or object or other complex data structure cannot be transported or stored or otherwise used outside of a running PHP script. If you want to persist such a complex data structure beyond a single run of a script, you need to serialize it. That just means to put the structure into a “lower common denominator” that can be handled by things other than PHP, like databases, text files, sockets. The standard PHP function serialize is just a format to express such a thing, it serializes a data structure into a string representation that’s unique to PHP and can be reversed into a PHP object using unserialize. There are many other formats though, like JSON or XML.
So if you have a PHP array, object, etc., say
$array = array(
'key value' => array(
'more info' => array(1,2,3)
),
'another key' => array(
'and so on' => '<span>so on</span>'
)
);
With PHP you can use serialize()
and unserialize()
to turn it into a string. You can see yourself with a script like:
$storeArray = serialize($array);
echo "<pre>".print_r($storeArray,true)."</pre>";
$restore = unserialize($storeArray);
echo "<pre>".print_r($restore,true)."</pre>";
UPDATE: and as @TomJNowell reminded (thanks!):
WP auto-serialises and deserialises on the fly if you pass objects or arrays into APIs for saving
With WordPress, for example with the Options API, passing your array into add_option()
will save your array as a serialized string in the _options
table. Retrieving the value with get_option()
will auto-unseralizes it for you, and the value got will be the same as the original $array you passed added in:
add_option('my_array', $array);
$my_array = get_option('my_array');
echo "<pre>".print_r($my_array,true)."<pre>";