I have a JSON string with some values that I unserialized into an object (STDClass/Object).
There are a couple of values in it, but I have to extract exactly 8 of those values into an multidimensional array. This snippet shows the values I'm after as they existed in the JSON:
"picture1":"path/to/image/picture1.jpg"
"picture1_color":"#000000"
"picture2":"path/to/image/picture2.jpg"
"picture2_color":"#111111"
"picture3":"path/to/image/picture3.jpg"
"picture3_color":"#222222"
"picture4":"path/to/image/picture4.jpg"
"picture4_color":"#333333"
I want to extract these values and put them into an array like this:
Array
(
[0] => Array
(
[picture] => path/to/image/picture1.jpg
[color] => #000000
)
[1] => Array
(
[picture] => path/to/image/picture2.jpg
[color] => #111111
)
and so forth
)
Is this doable programmatically or do I just need to do it by hand?