PHP code example of lezhnev / time-scheduler

1. Go to this page and download the library: Download lezhnev/time-scheduler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lezhnev / time-scheduler example snippets


use TimeScheduler\Classes\TimeScheduler;

$scheduler = new TimeScheduler();

//if t Time table
$scheduler->setScheduleTimeSlots(
    [
        "Mon" => ["12:30", "12:40"],
        "Tue" => [],
        "Wed" => [],
        "Thu" => ["21:30"],
        "Fri" => [],
        "Sat" => [],
        "Sun" => [],
    ]
);

// iteratively call getNextTimeSlot() to get next slot from time table
$time1 = $scheduler->getNextTimeSlot(); 
$time2 = $scheduler->getNextTimeSlot();

date("H:i",$time1); // will be "12:30"
date("H:i",$time2); // will be "12:40"