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
)
Link to comment
https://forums.phpfreaks.com/topic/278978-group-part-of-an-array/
Share on other sites

you already have a thread for this or for similar processing of your data. if this is the same type of processing, but for a different key in your array, the method will be exactly the same as in your previous thread. continue your problem in your existing thread.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.