<?php
    $dobaTrvani = 30;
    $vymazani = 0;
    $zacatek = "08:00";
    $konec = "16:00";


    function casy($dobaTrvani, $vymazani, $zacatek, $konec){
        $zacatek = new DateTime($zacatek);
        $konec = new DateTime($konec);
        $interval = new DateInterval("PT".$dobaTrvani."M");
        $vymazatInterval = new DateInterval("PT".$vymazani."M");
        $slots = array();

        for ($i=$zacatek; $i < $konec ; $i->add($interval)->add($vymazatInterval)) { 
            $konecSlotu = clone $i;
            $konecSlotu->add($interval);
            if ($konecSlotu>$konec) {
                break;
            }
            $slots[] = $i->format("H:i")/* ." - ".$konecSlotu->format("H:i") */;
        }
        return $slots;

    }
?>





