S
S
scher_khan2014-11-22 19:09:52
Parsing
scher_khan, 2014-11-22 19:09:52

How to parse text and convert it to an array?

Hello,
I have this text:

{{
#foo([
    'key'  => 'value',
    'key2' => #bar([
        'barKey' => 222,
        'barKey2' => #anotherFoo([
            'key' => 'value'
        ])
    ])
])
}}

Need to convert it to an array
[
    'widgetName' => 'foo',
    'widgetValue' => [
        'key' => 'value',
        'key2' => [
            'widgetName' => 'bar',
            'widgetValue' => [
                'barKey' => 222,
                'barKey2' => [
                    'widgetName' => 'anotherFoo',
                    'widgetValue' => [
                        'key' => 'value'
                    ]
                ]
            ]
        ]
    ]
]

Thank you in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question