I currently have an array of location based information similar to below (which is already sorted by time). The first key/value is event which represents the start of a journey (00), a running journey (01) and an end of a journey (10).
Array (
[0] => Array ( [event] => 00 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[1] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[2] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[3] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[4] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[5] => Array ( [event] => 10 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[6] => Array ( [event] => 00 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[7] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[8] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[9] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[10] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[11] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[12] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[13] => Array ( [event] => 10 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[14] => Array ( [event] => 00 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[15] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[16] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[17] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[18] => Array ( [event] => 10 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
)
How can I split the array even further so it creates a new array for every journey so I would end up with this:
Array (
[0] => Array (
[0] => Array ( [event] => 00 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[1] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[2] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[3] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[4] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[5] => Array ( [event] => 10 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
)
[1] => Array (
[0] => Array ( [event] => 00 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[1] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[2] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[3] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[4] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[5] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[6] => Array ( [event] => 01 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
[7] => Array ( [event] => 10 [time] => 1329293878 [lat] => 66.66666 [lon] => 11.11111 )
)
...
)
I haven't tried anything yet (except for googling) as I don't really know where to start.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…