承接 madesimple/php-arrays 相关项目开发

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

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

madesimple/php-arrays

最新稳定版本:v3.0.0

Composer 安装命令:

composer require madesimple/php-arrays

包简介

Helper functions for manipulating arrays

README 文档

README

PHPUnit

Helper functions for manipulating arrays.

Arr & ArrDots

Arr and ArrDots contains a set of static helper methods for arrays. These methods can be used on both array and \ArrayAccess objects. See the PHPDocs inside the classes for more information.

Dots

Dots is an implementation of \ArrayAccess that uses the functions from \MadeSimple\ArrDots. Instances of Dots can be passed into ArrDots as if it were an array.

There are three ways to create a Dots:

// Create an empty dot array
$dots = new \MadeSimple\Dots();

// Create a dot array with a pre-existing array
$dots = new \MadeSimple\Dots($array);

// Create a dot array with 
$dots = new \MadeSimple\Dots([
    'address' => [
        'houseNo'  => '123',
        'street'   => 'Fake St',
        'postCode' => 'AB12 3CD',
    ],
    'comments' => [
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
        'Donec nec pellentesque est.',
        'Quisque volutpat quam et est laoreet, vitae consectetur erat molestie.',
    ]
]);

Once a Dots is created you can replace the underlining array in the following ways:

// Set an array after dot array
// Changes will _not_ be reflected in the original array
$dots->setArray($array);

// Set an array as a reference
// Changes will be reflected in the original array
$dots->setReference($array);

Basic usage of Dots:

// Get a value using dot notation:
echo "Post Code: ", $dots['address.postCode'], PHP_EOL;

// Set a value using dot notation:
$dots['address.postCode'] = 'EF45 6GH';
echo "Post Code: ", $dots['address.postCode'], PHP_EOL;

// Remove a value using dot notation:
unset($dots['address.postCode']);
echo "Exists: ", (isset($dots['address.postCode']) ? 'yes' : 'no'), PHP_EOL;

// Add a value using dot notation:
$dots['address.postCode'] = 'IJ78 9KL';
echo "Post Code: ", $dots['address.postCode'], PHP_EOL;

// Access nth element in an sub array
echo "Comment: ", $dots['comments.1'], PHP_EOL;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固