isSerialized()
isSerialized(string $value, mixed $result = null) : boolean
Checks if a string is serialized using quick string manipulation to throw out obviously incorrect strings. Unserialize is then run on the string to perform the final verification.
Valid serialized forms are the following:
- boolean:
b:1;
- integer:
i:1;
- double:
d:0.2;
- string:
s:4:"test";
- array:
a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}
- object:
O:8:"stdClass":0:{}
- null:
N;
Parameters
string | $value | Value to test for serialized form |
mixed | $result | Result of unserialize() of the $value |
Returns
boolean —True if $value is serialized data, otherwise false