inscure / collection
1.2.1
2015-01-24 21:19 UTC
This package is not auto-updated.
Last update: 2024-09-28 17:07:20 UTC
README
集合
PHP中数组的目标实现
安装
Composer
{ "require": { "inscure/collection": "1.2.1" } }
用法
<?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