定制 gorogoroyasu/arylr 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

gorogoroyasu/arylr

最新稳定版本:0.16

Composer 安装命令:

composer require gorogoroyasu/arylr

包简介

Array Converter

README 文档

README

PHP Array Regularizer
CircleCI

Usage

There are more samples in tests/StoreTest.php

use Aryrl/Store;

$array = [
        [1, 2],
        [4, 5, 6],
        [7, 8, 9]
];
$options = [
    'row' => 'max',  # or int >= 1
    'col' => 'max',  # or int >= 1
    'colmns' => ['a'],
    'others' => ['d'],
];

$s = Store($array, $options);
$s->getPruned();
// => [
//  [1, 2, null],
//  [4, 5, 6],
//  [7, 8, 9],
// ]
$s->getPrunedT(); # transpose
// => [
//  [1, 4, 7],
//  [2, 5, 8],
//  [null, 6, 9],
// ]
$s->getNamed();
//  ['a' => 1, 'b' => [2, null]],
//  ['a' => 4, 'b' => [5, 6]],
//  ['a' => 7, 'b' => [8, 9],
// ]
$s->getNamedT(); # transpose
//  [
//      'a' => [1, 4, 7],
//      'default' => [[2, 3], [5, 6], [8, 9]],
//  ],
// ]

/** Checking uniqueness is only implemented for named property */
$array = [
    [1, 2, 3],
    [1, 2, 3],
    [2, 3, 4],
];
$s = Store($array, $options);
$s->namedUniqueness();
//  [
//      'a' => [1 => [0, 1]],
//      'b' => [2 => [0, 1]],
//      'c' => [3 => [0, 1]],
//  ],

$s->namedUniqueness('a');
//  [1 => [0, 1]],


/** Checking uniqueness is only implemented for named property */
$array = [
    [1, 2, null],
    [1, 2, null],
    [null, null, null],
];
$s = Store($array, ['drop' => true]);
$s->getPruned();

// => [
//  [1, 2],
//  [4, 5],
// ]

Caution

This Library only treats 2 dimensional array.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固