17
I would like to know how I could transform the given string into the specified array:
String
all ("hi there \(option\)", (this, that), other) another
Result wanted (Array)
[0] => all,
[1] => Array(
[0] => "hi there \(option\)",
[1] => Array(
[0] => this,
[1] => that
),
[2] => other
),
[2] => another
This is used for a kind of console that I'm making on PHP.
I tried to use preg_match_all but, I don't know how I could find parentheses inside parentheses in order to "make arrays inside arrays".
EDIT
All other characters that are not specified on the example should be treated as String.
EDIT 2
I forgot to mention that all parameter's outside the parentheses should be detected by the space character.