php - Decode a string from an array within an array back into an array
I have the following array (for instance)
Array
(
[0] => 2
[1] => 134
[2] => 7
)
Inside another array, of the form
Array
(
[_page_list] => Array
(
[0] => a:3:{i:0;s:1:"2";i:1;s:3:"134";i:2;s:1:"7";}
)
[some more data...]
)
This has been put into a Json and then decoded back again, giving me as an element just the string "a :3:{i:0;s:1:\"2\";i:1;s:3:\"134\";i:2;s:1:\"7\";}" inside the bigger array. This doesn't seem to be itself a json string, nor can it be simply cast back into an array.
How can I cast this string back into the proper array it used to be?
Answer
Solution:
That's a PHP serialized string, see the documentation here:
http://php.net/manual/en/function.serialize.php
You can decode it with
unserialize
, e.g.=