Let's say I have this output from some source where I don't have access to the original PHP created array:
Array
(
[products] => Array
(
[name] => Arduino Nano Version 3.0 mit ATMEGA328P
[id] => 10005
)
[listings] => Array
(
[category] =>
[title] => This is the first line
This is the second line
[subtitle] => This is the first subtitle
This is the second subtitle
[price] => 24.95
[quantity] =>
[stock] =>
[shipping_method] => Slow and cheap
[condition] => New
[defects] =>
)
[table_count] => 2
[tables] => Array
(
[0] => products
[1] => listings
)
)
Now I would like to input that data and have an algorithm recreate the original array that it was printing so I can then use it for my own application.
Currently I am thinking about a sub_str()
and regex statements that pull data and place it appropriately. Before I head further, is there a simpler way, via already written code or php plugins that do this for me already out there?
IT MUST WORK FOR MULTIDEMNSIONAL ARRAY - so this post does not work and it even references the correct function to use: How create an array from the output of an array printed with print_r?