Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7523033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:40:47+00:00 2026-05-30T02:40:47+00:00

I currently have an array of location based information similar to below (which is

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:40:48+00:00Added an answer on May 30, 2026 at 2:40 am

    you need a custom solution like so:

     $outputArray = array(); $currentArray = array();
     foreach($inputArray as $key=>$subArray) {
       if($subArray['event']==00) {
          $outputArray[] = $currentArray;
          $currentArray = array($subArray);
       } else {
          $currentArray[] = $subArray;
       }
     }
     $outputArray[] = $currentArray;
     array_shift($outputArray);
    

    put in $inputArray and then get out $outputArray. Enjoy!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have the following code : $content = <name>Manufacturer</name><value>John Deere</value><name>Year</name><value>2001</value><name>Location</name><value>NSW</value><name>Hours</name><value>6320</value>; I need to
Currently I have an Array that is having 9 buttons pushed to it. This
I currently have the dynamic array: char *myData[500][10]; //myData is the name of an
I currently have a numpy multi-dimensional array (of type float) and a numpy column
I am currently trying to copy an array I have to a new view
I have an API call that returns a byte array. I currently stream the
I am currently trying to pass an array that I have created in Javascript
I currently have a statement which reads if(Arrays.asList(results).contains(Word)); and I want to add at
I have the following script currently, which gets the category IDs as arrays: $sql_select_categories
I have an array containing specific times and I want when the current time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.