I have an array which contains serialized data similar to the example below.
Array
(
[0] => Array
(
[id] => 4
[data] => a:2:{s:6:"Series";a:1:{s:11:"description";s:11:"hello world";}s:4:"Type";a:1:{i:0;s:1:"1";}}
[created] => 2009-10-12 18:45:35
)
[1] => Array
(
[id] => 3
[data] => a:2:{s:6:"Series";a:1:{s:11:"description";s:11:"hello world";}s:4:"Type";a:1:{i:0;s:1:"1";}}
[created] => 2009-10-12 17:39:41
)
...
)
What would be the best way to unserialize the value of the data key and replace the serialized data with its contents?
I have tried looping using a reference which works although the last two entries in the array are identical when they shouldn't be.
foreach($data as &$item) {
$item['data'] = unserialize($item['data']);
}