PHP code example of max13 / dtion

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

    

max13 / dtion example snippets


use Dtion\Dtion;
use Dtion\DtionList;

$priorNoticeList = new DtionList([
    new Dtion(1, 5, new DateInterval('P1M'),
    new Dtion(6, 7, new DateInterval('P2M'),
    new Dtion(8, 12, new DateInterval('P3M'),
]);


$category = 2;
$p = $priorNoticeList->resultFor($category);
// returns DateInterval('P1M')

$dtion = $priorNoticeList->find($category);
// returns the corresponding Dtion, or null if not found.
$result = $dtion->result();