承接 mobileka/mosaic-array 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mobileka/mosaic-array

最新稳定版本:1.0.0

Composer 安装命令:

composer require mobileka/mosaic-array

包简介

A simple array manipulation class

README 文档

README

Build Status Coverage Status Code Climate

A simple array manipulation class.

Requirements:

PHP >= 5.4.*

Some examples:

A very common case when you need to do something like this:

if (isset($arr['key']) {
	$result = $arr['key'];
} else {
	$result = 'default';
}

// another way to write the same thing
$result = isset($arr['key']) ? $arr['key'] : 'default';

With MosaicArray you can do the same thing more elegantly:

$result = MosaicArray::make($arr)->getItem('key', 'default');
//or
$ma = new MosaicArray($arr);
$result = $ma->getItem('key', 'default');

MosaicArray implements ArrayAccess, IteratorAggregate, Countable and Serializable interfaces, so you can access an instance of this class as an array, iterate over it, count elements, serialize and unserialize it:

$numbers = new MosaicArray([1, 2, 3]);

echo $numbers[0]; //1

foreach ($numbers as $number) {
	// do something
}

echo count($numbers); // 3

serialize($numbers);
unserialize($numbers);

License

MosaicArray is open-source and licensed under the MIT License

统计信息

  • 总下载量: 1.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-15