kasseler / collection
This package is abandoned and no longer maintained.
No replacement package was suggested.
Array collection library
1.0.2
2015-03-25 20:26 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2020-01-24 15:46:24 UTC
README
Requirements
- PHP >= 5.4
Installation
$ composer require kasseler/collection
Usage
$collection = new ArrayCollection([ 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5, ]); echo $collection->get('one'); // return one key echo $collection->two; // return two key echo $collection['three']; // return three key foreach ($collection as $key => $value) { /* * return * key[one] = '1'; * key[two] = '2'; * key[three] = '3'; * key[four] = '4'; * key[five] = '5'; */ echo sprintf("\nkey[%s] = '%s';", $key, $value); } echo $collection; //return serialize array unset($collection['four']); $collection->remove('five'); echo count($collection); // return 3