1. Go to this page and download the library: Download dan-on/php-interval-tree 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/ */
dan-on / php-interval-tree example snippets
use Danon\IntervalTree\IntervalTree;
$tree = new IntervalTree();
$tree->insert(new NumericInterval(1, 10), 'val1');
$tree->insert(new NumericInterval(2, 5), 'val2');
$tree->insert(new NumericInterval(11, 12), 'val3');
use Danon\IntervalTree\Interval\NumericInterval;
// Instantiate numeric interval from array
$numericInterval = NumericInterval::fromArray([1, 100]);
// Instantiate numeric interval with constructor
$numericInterval = new NumericInterval(1, 100);
use Danon\IntervalTree\Interval\DateTimeInterval;
// Instantiate DateTime interval from array
$dateTimeInterval = DateTimeInterval::fromArray([
new DateTimeImmutable('2021-01-01 00:00:00'),
new DateTimeImmutable('2021-01-02 00:00:00'),
]);
// Instantiate DateTime interval with constructor
$dateTimeInterval = new DateTimeInterval(
new DateTimeImmutable('2021-01-01 00:00:00'),
new DateTimeImmutable('2021-01-02 00:00:00')
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.