I have serialized data and I am using PHP unserialize function which is not working for me. I do not know what is wrong with this string. This is how my serialized data look like. My PHP knowledge is limited so I could not figure out the issue in this data. Can any one help me with this.
s:73:"a:5:{i:0;s:4:"8941";i:1;s:4:"8939";i:2;s:4:"8942";i:3;s:4:"8946";i:4;s:4:"8950";}";
You have a serialized string that contains a serialized array. The string length is 81 not 73.
s:81:"characters in between the first and last quotes and in the example there are 81"
$string = 's:81:"a:5:{i:0;s:4:"8941";i:1;s:4:"8939";i:2;s:4:"8942";i:3;s:4:"8946";i:4;s:4:"8950";}";';
$result = unserialize($string);
Yields the serialized array:
a:5:{i:0;s:4:"8941";i:1;s:4:"8939";i:2;s:4:"8942";i:3;s:4:"8946";i:4;s:4:"8950";}
Unserialize that:
$array = unserialize($result);
Yields the array:
Array
(
[0] => 8941
[1] => 8939
[2] => 8942
[3] => 8946
[4] => 8950
)