Print array with checkboxes, want the values

69 Views Asked by At

I have an array where i have Checkboxes in.

Each category of checkboxes contains 4 options, and you can choose as many as you want to. I dont know how to get the value without serializing. Can anybody help me?

My array looks like this serialized:

a:4:{i:0;s:1:"5";i:1;s:1:"6";i:2;s:1:"7";i:3;s:1:"8";}

So i only want the values between the " " tags, how can i get this?

2

There are 2 best solutions below

6
On BEST ANSWER

You should use unserialize.

If not, then try this:

$str = 'a:4:{i:0;s:1:"5";i:1;s:1:"6";i:2;s:1:"7";i:3;s:1:"8";}';
preg_match_all(  '/"(\d+)"/', $str, $matches );

print_r($matches[1]);
0
On

you can try with unserialize()

$org=unserialize($array)
var_export()