PHP code example of mparulski / collection-type
1. Go to this page and download the library: Download mparulski/collection-type 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/ */
mparulski / collection-type example snippets
use CollectionType\Collection\CollectionSet\HashSet;
use CollectionType\TypeValidator\ObjectTypeValidator;
$set = new HashSet(new IntegerTypeValidator());
$set->add(1);
$set->add(5);
// throw exception
$set->add(7.2);