You’re looking at a serialized representation of the array Array( '75', '68' )
. Serialization is the process by which PHP stores a data object as a string, much like the manner in which JSON is a string representation of a Javascript object. PHP data structures may be converted into a serialized format via PHP’s serialize()
, and back again using unserialize()
.
WordPress also provides functions which perform the necessary action only when needed in order to prevent accidental double-serialization or unserialization: maybe_serialize()
and maybe_unserialize()
. You can also check yourself with WordPress’ is_serialized()
.
From the comments on PHP’s serialize()
, the anatomy of a serialized data object is as follows:
String
s:size:value;
Integer
i:value;
Boolean
b:value;
(does not store"true"
or"false"
, does store1
or
0
)Null
N;
Array
a:size:{key definition;value definition;(repeated per element)}
Object
O:strlen(object name):object name:object
size
s:strlen(property name):property name:property definition;(repeated per property)
String values are always in double quotes.
Array keys are always integers or strings; using other types as keys produces undesirable results:
null => 'value'
equates to's:0:"";s:5:"value";'
true => 'value'
equates to'i:1;s:5:"value";'
false => 'value'
equates to'i:0;s:5:"value";'
array(whatever the contents) => 'value'
equates to an “illegal offset type” warning because you can’t use an array as a key; however, if you use a variable containing an array as a key, it will equate to's:5:"Array";s:5:"value";'
, and attempting to use an object as a key will result in the same behavior as using an array will.
Therefore, we can interpret your particular serialized array a:2:{i:0;s:2:"75";i:1;s:2:"68";}
as such:
a:2:{
an array of length 2, containing:i:0;
at the integer key0
(i.e. index0
):s:2:"75";
a string of length 2 with the value “75”
i:1;
at the integer key1
(i.e. index1
):s:2:"68"
a string of length 2 with the value “68”
}
end of the array
To alternately reflect the values of your items 'content'
and 'lkajsdf'
rather than their numerical identifiers, then, the array Array( 'content', 'lkajsdf' )
would be serialized as
a:2:{i:0;s:7:"content";i:1;s:7:"lkajsdf";}
Knowing this can come in handy if you ever need to alter some of WordPress’s settings, or selectively activate/deactivate specific plugins directly from the database.