Advertisement
Guest User

worktimeparser

a guest
Nov 3rd, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. function workTimeFormat($DATA) {
  2.     if(is_array($DATA)) {
  3.         $arDays = Array('Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс');
  4.         $newArray = Array();
  5.         $prevTime = false;
  6.         $newArrPrevIndex = 0;
  7.        
  8.         foreach($DATA as $INDEX => $TIME) {
  9.             if($TIME == $prevTime) {
  10.                 $newArray[$newArrPrevIndex-1][$INDEX] = $TIME;
  11.             } else {
  12.                 $newArray[][$INDEX] = $TIME;
  13.                 $newArrPrevIndex++;
  14.             }
  15.            
  16.             $prevTime = $TIME;
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement