PHP code example of mmerlijn / helper-time-array

1. Go to this page and download the library: Download mmerlijn/helper-time-array 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/ */

    

mmerlijn / helper-time-array example snippets


[[600,660],[720,800]]

[[600,700],[700,800]] => [[600,800]]

$t = new TimeArray();

//or with initial value

$t = new TimeArray([[500,600],[700,800]]); //multiple intervals
$t = new TimeArray([600,720]); //one interval

$t = new TimeArray();
$t->create([600,700]);

$t = $t->add([600,700]); //add 10:00-11:40 

$t = $t->substract([650,700]); //reduce the time Array

$t->get(); //
 

(new TimeArray([500,600]))->add([700,800])->substract([750,800])->get();