PHP code example of takuya / php-time-overlap

1. Go to this page and download the library: Download takuya/php-time-overlap 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/ */

    

takuya / php-time-overlap example snippets


use Takuya\PhpTimeOverlap\TimeRange;
$a = new TimeRange(new DateTime( '22:22' ),new DateTime( '23:22' ));
$b = new TimeRange(new DateTime( '22:44' ),new DateTime( '23:44' ));

## check time overlap
$a->has_overlapping($b); // => true


$a->before($b);
$a->overlapped($b);
$a->during($b);
$a->overlaps($b);
$a->after($b); 
$a->contains($b);
$a->same($b);
shell
composer config repositories.'php-timerange-overlap' \
         vcs https://github.com/takuya/php-timerange-overlap
composer 
shell
composer 
shell
git clone https://github.com/takuya/php-timerange-overlap
cd php-timerange-overlap
composer install 
vendor/bin/phpunit