This is difficult to explain, so I'll give an example. I have the following array of file names:
Array
(
[38] => CP.W.CC.0805
[39] => CP.W.CC.0812
[42] => CP.W.S.0805
[43] => CP.W.S.0812
[66] => IP.W.CC.0805
[67] => IP.W.CC.0812
[70] => IP.W.SP.0805
[71] => IP.W.SP.0812
[84] => MV.W.CC.0805
[85] => MV.W.CC.0812
[88] => MV.W.RCC.0805
[89] => MV.W.RCC.0812
[90] => MV.W.RS.0805
[91] => MV.W.RS.0812
[92] => MV.W.SP.0805
[93] => MV.W.SP.0812
[96] => NG.W.IN.0805
[97] => NG.W.IN.0812
)
And I'd like to turn it into:
Array
(
[0805] => Array
(
[38] => CP.W.CC.0805
[42] => CP.W.S.0805
[66] => IP.W.CC.0805
[70] => IP.W.SP.0805
[84] => MV.W.CC.0805
[88] => MV.W.RCC.0805
[90] => MV.W.RS.0805
[92] => MV.W.SP.0805
[96] => NG.W.IN.0805
)
[0812] => Array
(
[39] => CP.W.CC.0812
[43] => CP.W.S.0812
[67] => IP.W.CC.0812
[71] => IP.W.SP.0812
[85] => MV.W.CC.0812
[89] => MV.W.RCC.0812
[91] => MV.W.RS.0812
[93] => MV.W.SP.0812
[97] => NG.W.IN.0812
)
)
Note that the keys for the first-level array are the last four characters of the item (eg. substr($a, -4)).
I don't care about the keys themselves (other than the first-level array that I want to create)
Andy bright ideas?
Array
(
[38] => CP.W.CC.0805
[39] => CP.W.CC.0812
[42] => CP.W.S.0805
[43] => CP.W.S.0812
[66] => IP.W.CC.0805
[67] => IP.W.CC.0812
[70] => IP.W.SP.0805
[71] => IP.W.SP.0812
[84] => MV.W.CC.0805
[85] => MV.W.CC.0812
[88] => MV.W.RCC.0805
[89] => MV.W.RCC.0812
[90] => MV.W.RS.0805
[91] => MV.W.RS.0812
[92] => MV.W.SP.0805
[93] => MV.W.SP.0812
[96] => NG.W.IN.0805
[97] => NG.W.IN.0812
)
And I'd like to turn it into:
Array
(
[0805] => Array
(
[38] => CP.W.CC.0805
[42] => CP.W.S.0805
[66] => IP.W.CC.0805
[70] => IP.W.SP.0805
[84] => MV.W.CC.0805
[88] => MV.W.RCC.0805
[90] => MV.W.RS.0805
[92] => MV.W.SP.0805
[96] => NG.W.IN.0805
)
[0812] => Array
(
[39] => CP.W.CC.0812
[43] => CP.W.S.0812
[67] => IP.W.CC.0812
[71] => IP.W.SP.0812
[85] => MV.W.CC.0812
[89] => MV.W.RCC.0812
[91] => MV.W.RS.0812
[93] => MV.W.SP.0812
[97] => NG.W.IN.0812
)
)
Note that the keys for the first-level array are the last four characters of the item (eg. substr($a, -4)).
I don't care about the keys themselves (other than the first-level array that I want to create)
Andy bright ideas?