I have a very big array, I will try to explain the issue in small examples:
Input:
Array ( 
[alert:accountDisabled:heading] => XYZ 
[alert:accountDisabled:message] => XYZ
[alert:accountExpired:heading] => XYZ 
[alert:accountExpired:message] => XYZ
[alert:errorResponse:heading] => XYZ 
[button:back] => XYZ 
)
What I need to get is:
array() { 
    ["alert"]=> array(7) { 
        ["accountDisabled"]=> array(2) { 
            ["heading"]=> string(3) "XYZ" 
            ["message"]=> string(3) "XYZ" } 
       ["accountExpired"]=> array(2) { 
           ["heading"]=> string(3) "XYZ" 
           ["message"]=> string(3) "XYZ" } 
      ["clientError"]=> array(2) { 
          ["heading"]=> string(3) "XYZ" 
          ["message"]=> string(3) "XYZ" } 
      ["errorResponse"]=> array(1) { 
          ["heading"]=> string(3) "XYZ" } 
 }
 ["button"]=> array(1) { 
     ["back"]=> string(3) "XYZ"
 }
As I said this is a very small example, but the point is to get hierarchy from keys from array number one, hierarchy is divided by this character in key :
I checked for those questions that look similar to this one but they are not helpful lat all
How to access and manipulate multi-dimensional array by key names / path?
Using a string path to set nested array data
SO please read carefully the description of my issue. I tried to use it for each loop, and I succeed to divide elements from the key, for one element, but I'm not sure where I need to store those hierarchy values for the next elements, any ideas?
 
    