raulfraile/idatha

Data structures library for PHP

dev-master 2013-12-24 02:02 UTC

This package is not auto-updated.

Last update: 2024-11-19 02:27:16 UTC


README

Data structures library for PHP

$set = new Idatha\Set();

$set->add(1);
$set->add(2);

var_dump($set->isMember(1)); // true
var_dump($set->isMember(3)); // false

$set2 = new Idatha\Set();
$set->add(2);
$set->add(3);
$set->add(4);

var_dump($set->union($set2)->toArray()); // array(1,2,3,4)
var_dump($set->intersection($set2)->toArray()); // array(2)
var_dump($set2->complement($set)->toArray()); // array(3,4)
var_dump($set->isSubset($set2)); // false