I have this example php string:
$string = "@[item_1][door] @[mozart][grass] = yes @[mozart][green] = no @[mozart][human] @[blue][movie]=yes @[item_1][beat] = yes @[item_1][music] = no ";
now $string idented just to easy view:
@[item_1][door]
@[mozart][grass] = yes
@[mozart][green] = no
@[mozart][human]
@[blue][movie]=yes
@[item_1][beat] = yes
@[item_1][music] = no
I want to know how can i get this string ( or other string following this style ) and transform in an array that looks like:
Array
(
[item_1] => Array
(
[door] => Array
(
[mozart] => Array
(
[grass] => yes
[green] => no
[human] => Array
(
[blue] => Array
(
[movie] => yes
)
)
)
)
[beat] => yes
[music] => no
)
)
What i tried
I tried to use and recursive function to create an nested array but i can't have access to the array pointer ( in deep levels ) in recursive functions.. don't know why.. maybe is the wrong patch to the answer. thank you,