inscure/collection

1.2.1 2015-01-24 21:19 UTC

This package is not auto-updated.

Last update: 2024-04-13 14:56:03 UTC


README

Build Status

Collection

Objective implementation of arrays in PHP

Installation

Composer

{
    "require": {
        "inscure/collection": "1.2.1"
    }
}

Usages

<?php

$array = new Collection\Collection(array(1, 2, 3, 4, 5));

echo $array->get(4); // 5 

echo count($array);  // 5

foreach($array as $key => $value) {
    echo $key . '=>' . $value . '<br />';
}

// 0 => 1
// 1 => 2
// 2 => 3
// 3 => 4
// 4 => 5

$array[0] = null;

foreach($array as $key => $value) {
    echo $key . '=>' . $value . '<br />';
}

// 0 => 
// 1 => 2
// 2 => 3
// 3 => 4
// 4 => 5