srph/map-range
最新稳定版本:v0.1.0
Composer 安装命令:
composer require srph/map-range
包简介
A more efficient foreach-range
README 文档
README
composer require srph/map-range
A more efficient foreach-range.
Usage
SRPH\MapRange\map_range(function($index) { // do something }, $from, $to);
For PHP >=v5.6, you can use the use function (aka import function) syntax:
use function SRPH\MapRange\map_range; map_range(function($index) { // do something }, $from, $to);
Note that it iterates while $from <= $to.
Why
Because some developers prefer this
foreach(range(0, 10) as $i) { // .. }
Over this:
for ( $i = 0; $i < 10; $i++ ) { // }
In which the first example generates a buffer array first (which is terrible for performance).
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-26