p810/dot

使用点表示法遍历数组的实用工具

4.0.0 2019-08-08 20:19 UTC

This package is auto-updated.

Last update: 2024-09-09 07:36:07 UTC


README

使用点表示法遍历数组的实用工具

安装

$ composer require p810/dot

示例用法

<?php

p810\Dot\find('foo.bar', [
    'foo' => [
        'bar' => 'Hello world!'
    ]
]);
#=> string(12) "Hello world!"

API

p810\Dot\find(string $needle, array $haystack): mixed

基于点表示法的键字符串搜索数组中的值

💡 p810\Dot\search() 是此函数的别名

p810\Dot\getKeysFromString(string $keys): array<int,string|int>

从点表示法的字符串中返回键的列表

许可证

此软件包在MIT许可证下发布。