Mam przykładową tablicę:
0 => 0 => object(DateTime)[833] public 'date' => string '2013-04-18 09:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) 1 => object(DateTime)[835] public 'date' => string '2013-04-18 13:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) 1 => 0 => object(DateTime)[827] public 'date' => string '2013-04-18 09:20:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) 1 => object(DateTime)[839] public 'date' => string '2013-04-18 10:27:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) 2 => 0 => object(DateTime)[804] public 'date' => string '2013-04-18 12:40:20' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) 1 => object(DateTime)[865] public 'date' => string '2013-04-18 17:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) 3 => 0 => object(DateTime)[834] public 'date' => string '2013-04-18 14:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3) 1 => object(DateTime)[865] public 'date' => string '2013-04-18 17:00:00' (length=19) public 'timezone_type' => int 3 public 'timezone' => string 'UTC' (length=3)
Każdy element tablicy zawiera dwa obiekty DateTime i oznacza przedział czasowy. W jaki sposób mogę usunąć elementy które zawierają przedział czasowy zawarty już w jakimś innym szerszym przedziale (na ten przykład: [1] 9:20-10:27 zawiera się w przedziale [0] 9:00-13:00, więc element 1 powinien w ogóle wylecieć). Poza tym chciałbym jeszcze scalić te przedziały, czyli np z dwóch: 9:00-11:30 i 10:00-12:00 chciałbym mieć jeden przedział, od 9:00 do 12:00. Jak to zrobić?