chdemko/interval

Interval for PHP >= 5.4

dev-master / 1.0.x-dev 2014-06-18 12:21 UTC

This package is auto-updated.

Last update: 2024-12-23 08:37:38 UTC


README

Downloads Latest Stable Version Latest Unstable Version Code coverage Build Status License

Interval for PHP.

This project uses:

Installation

Using composer: either

$ composer create-project chdemko/interval:1.0.x-dev --dev; cd interval

or create a composer.json file containing

{
    "require": {
        "chdemko/interval": "1.0.x-dev"
    }
}

and run

$ composer install

Create a test.php file containg

<?php
require __DIR__ . '/vendor/autoload.php';

use chdemko\Interval\Interval;

$interval = Interval::fromString('[2,3[');

echo $interval . PHP_EOL;

$interval->sup = 4;
echo $interval . PHP_EOL;

$interval->inf = - INF;
echo $interval . PHP_EOL;

if ($interval->contains(0))
{
	echo "0 is contained in $interval" . PHP_EOL;
}
else
{
	echo "0 is not contained in $interval" . PHP_EOL;
}

This should print

[2,3[
[2,4[
]-INF,4[
0 is contained in ]-INF,4[

See the examples folder for more information.

Documentation

Citation

If you are using this project including publication in research activities, you have to cite it using (BibTeX format). You are also pleased to send me an email to chdemko@gmail.com.