gamefreak13 Posted June 10, 2013 Share Posted June 10, 2013 (edited) 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 June 10, 2013 by gamefreak13 Quote Link to comment https://forums.phpfreaks.com/topic/278978-group-part-of-an-array/ Share on other sites More sharing options...
trq Posted June 10, 2013 Share Posted June 10, 2013 Cool. What have you tried? Quote Link to comment https://forums.phpfreaks.com/topic/278978-group-part-of-an-array/#findComment-1435088 Share on other sites More sharing options...
mac_gyver Posted June 10, 2013 Share Posted June 10, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/278978-group-part-of-an-array/#findComment-1435124 Share on other sites More sharing options...
Barand Posted June 10, 2013 Share Posted June 10, 2013 I agree with mac_gyver. Do not double post the same problem. Quote Link to comment https://forums.phpfreaks.com/topic/278978-group-part-of-an-array/#findComment-1435131 Share on other sites More sharing options...
gamefreak13 Posted June 11, 2013 Author Share Posted June 11, 2013 (edited) 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 June 11, 2013 by gamefreak13 Quote Link to comment https://forums.phpfreaks.com/topic/278978-group-part-of-an-array/#findComment-1435280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.