Jump to content

norbertk

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

About norbertk

  • Birthday 07/20/1986

Profile Information

  • Gender
    Male

norbertk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This is my array: Array ( [time_0900] => 0 [time_0915] => 0 [time_0930] => 0 [time_0945] => 0 [time_1000] => 0 [time_1015] => 0 [time_1030] => 2581 [time_1045] => 2581 [time_1100] => 0 [time_1115] => 0 [time_1130] => 0 [time_1145] => 2581 [time_1200] => 2581 [time_1215] => 2581 [time_1230] => 0 [time_1245] => 0 [time_1300] => 0 [time_1315] => 0 [time_1330] => 0 [time_1345] => 0 [time_1400] => 2617 [time_1415] => 2617 [time_1430] => 0 [time_1445] => 0 [time_1500] => 0 [time_1515] => 2617 [time_1530] => 2617 [time_1545] => 2617 [time_1600] => 0 [time_1615] => 0 [time_1630] => 0 [time_1645] => 0 [time_1700] => 2634 [time_1715] => 2634 [time_1730] => 2634 [time_1745] => 0 [time_1800] => 2633 [time_1815] => 2633 [time_1830] => 2635 [time_1845] => 2635 [time_1900] => 0 [time_1915] => 2633 [time_1930] => 0 [time_1945] => 2635 [time_2000] => 0 [time_2015] => 0 [time_2030] => 0 [time_2045] => 0 ) And this is what I want from it: Array (1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1) I just need it to combine the consecutive values, and array_count_values does not work because some values repeat themselves.
  2. Because the array is a time schedule, and the appointment has a gap.
  3. Thank you for the suggestion but I've already tried this. The problem with this function is that it will return the TOTAL count for the values, which is partially what I am trying to get at and where I am stuck. As I described above, because one id repeats itself later in the array, it can't be counted as consecutive.
  4. I have the following array: array('time_0945' => "0", 'time_1000' => "2636", 'time_1015' => "2636", 'time_1030' => "0", 'time_1045' => "2637", 'time_1100' => "2637", 'time_1115' => "2637", 'time_1130' => "2636"); The way that this is displayed is in a table in cell row fashion. The index is the time slot and the value is either '0' for no appointment, or any other number for an appointment id. What I am trying to do is calculate the number of times that the unique appointment occurs in consecutive order so that I can set a rowspan for table cell. What I have tried is: using array_unique; however if the appointment reoccurs again, such as above, that won't work. I have also attempted creating another array from that, but I can't figure out a way to count the number of times a consecutive value appears. What I ultimately would like is an output of: array(1, 2, 1, 3, 1) I am open to suggestions. I tried playing around with this topic but haven't been able to get what I want.
×
×
  • 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.