PHP code example of texdc / range

1. Go to this page and download the library: Download texdc/range 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/ */

    

texdc / range example snippets


use texdc\range\DateRange;

$dateRange = new DateRange(new DateTime, new DateTime('+1 month'));

assert($dateRange->

use texdc\range\IntegerRange;

$range1 = new IntegerRange(1, 5);
$range2 = new IntegerRange(8, 3);
$range3 = new IntegerRange(5, 8);

assert($range1->overlaps($range2));
assert($range2->isContraryTo($range1));
assert($range3->abuts($range2));
assert($range1->begins(IntegerRange::merge($range1, $range3)));
assert($range3->ends(IntegerRange::combine([$range1, $range3])));

use texdc\range\DateEnablement;

class DatedBannerAd extends AbstractBannerAd
{
    /**
     * @var DateEnablement
     */
    private $enablement;
    
    // ...
    
    public function render()
    {
        if ($this->enablement->isEnabled()) {
            return parent::render();
        }
    }
}