Reputation: 1131
i have the following data being pulled out from a databasse that is being inserted via checkboxes.
here is the print_r($sockets):
a:6:{i:0;s:6:"UK 15A";i:1;s:5:"CEE22";i:2;s:6:"Schuko";i:3;s:6:"French";i:4;s:5:"Swiss";i:5;s:6:"Danish";}
What is the best way just to show the checkbox value i.s the ones in-between quotes???
I tried to use explode(); but im not sure if this is right.
Thanks
Upvotes: 0
Views: 82
Reputation: 419
it is seralized array
you can use it like this
$sockets = unsiralize($sockets);
echo $sockets[0]; // UK 15A
echo $sockets[4]; // Swiss
Upvotes: 0
Reputation: 86406
It looks like serialized data.
you can use unserialize() on it
$data=unserialize($str);
print_r($data);
Result
Array
(
[0] => UK 15A
[1] => CEE22
[2] => Schuko
[3] => French
[4] => Swiss
[5] => Danish
)
Loop through the array and access the values.
Upvotes: 1