william-lindner/delimiter_array_access 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

william-lindner/delimiter_array_access

Composer 安装命令:

composer require william-lindner/delimiter_array_access

包简介

An accessor function for arrays that allows you to find nested values by delimited notation.

README 文档

README

Delimiter array access is a function that allows for the finding of array values by dot notation.

Sometimes it's just easier to read accessing array chains by a string with a delimiter. Instead of compound, chained accessors that may lead to unexpected errors this function is null safe. This isn't trying to be fast. It's trying to provide developers options in how they want their code read.

Descripton

delimiter_array_access( string $needle, array $haystack, [ string $delimiter = '.' ] ) : mixed

Installation

$ composer require william-lindner/delimiter_array_access

Parameters

needle (Required)

The string with delimiter you want parsed to extract the value from the array.

haystack (Required)

The array being parsed to find the value.

delimiter (Optional)

The optional delimiter for the string needle, defaulting to a period.

Example

In the following example the value nested within the array is extracted using the default delimiter of a period.

$myArray = [
  'my' => [
    'assoc' => [
      'array' => 'I found a value.'
    ]
  ]
];

// This will output 'I found a value.'
echo delimiter_array_access('my.assoc.array', $myArray) . PHP_EOL;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固