An immutable list with a fixed-length whose elements are indexed by their offset in the list.
Install into your project using Composer:
$ composer require scienide/tuple
- PHP 7.4 or above
use Tuple;
$tuple = new Tuple(5.0, 3, 'foo');
[$first, $second, $third] = $tuple->list();
foreach ($tuple as $offset => $value) {
//
}
echo count($tuple);
echo $tuple[2];
3
foo
To run the unit tests:
$ composer test
To run static code analysis:
$ composer analyze