I have group on string i want to explode by group and sub group
For example
operation.user.add
operation.user.edit
operation.permission.add
performance.tool.add
performance.tool.remove
operation.permission.edit
operation.tool.delete
operation.tool.remove
In want result as following:
Array
(
['operation'] => Array
(
['user'] => Array
(
[0] => 'add',
[1] => 'edit'
),
['permission'] => Array
(
[0] => 'add',
[1] => 'edit'
),
['tool'] => Array
(
[0] => 'delete',
[1] => 'remove'
),
),
['performance'] => Array
(
['tool'] => Array
(
[0] => 'add',
[1] => 'remove'
)
)
)
Can anybody give solution how i can convert string to array as above array?
Assuming that is one string value, this is probably as efficient as you can get:
Output: