Jump to content

Group part of an array


gamefreak13

Recommended Posts

This is the output of my array (yes it outputs an empty array too):

Array
(
)
Array
(
    [0] => 6/9/2013 10:36:54 PM
    [1] => Medical
    [2] => BROADWAY AVE
    [3] => FAKE RD/BOGUS LN
    [4] => E42
)
Array
(
    [0] => 6/9/2013 10:36:54 PM
    [1] => Medical
    [2] => BROADWAY AVE
    [3] => FAKE RD/BOGUS LN
    [4] => MR40
)
Array
(
    [0] => 6/9/2013 10:29:01 PM
    [1] => Vehicle Rescue
    [2] => I-15 NB
    [3] => 
    [4] => E37
)
Array
(
    [0] => 6/9/2013 10:29:01 PM
    [1] => Vehicle Rescue
    [2] => I-15 NB
    [3] => 
    [4] => M37
)
Array
(
    [0] => 6/9/2013 10:29:01 PM
    [1] => Vehicle Rescue
    [2] => I-15 NB
    [3] => 
    [4] => MR38
)
Array
(
    [0] => 6/9/2013 10:28:21 PM
    [1] => Medical
    [2] => MAIN ST
    [3] => SOME ST/NOWHERE DR
    [4] => E33
)
Array
(
    [0] => 6/9/2013 10:28:21 PM
    [1] => Medical
    [2] => MAIN ST
    [3] => SOME ST/NOWHERE DR
    [4] => MR33
)

I need to combine [4] together (seperated by commas) if [0] through [3] are the same.

 

The naming is as follows:

 

0 = time

1 = type

2 = address

3 = cross streets

4 = units/apparatus

 

Desired output of the above array:

Array
(
    [0] => 6/9/2013 10:36:54 PM
    [1] => Medical
    [2] => BROADWAY AVE
    [3] => FAKE RD/BOGUS LN
    [4] => E42, MR40
)
Array
(
    [0] => 6/9/2013 10:29:01 PM
    [1] => Vehicle Rescue
    [2] => I-15 NB
    [3] => 
    [4] => E37, M37, MR38
)
Array
(
    [0] => 6/9/2013 10:28:21 PM
    [1] => Medical
    [2] => MAIN ST
    [3] => SOME ST/NOWHERE DR
    [4] => E33, MR33
)
Edited by gamefreak13
Link to comment
Share on other sites

I double-posted because my other thread is far too in depth and confusing, so most members probably just skipped right over it. The suggestions are not working (probably because I changed the data structure to try to simplify things, but really it just made it impossible for me to use the suggestions). So I thought I'd simplify things by starting a new thread.

Edited by gamefreak13
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.