mirkoschmidt/arraydot

处理多维数组和点符号的函数。

v1.0.3 2018-04-19 13:47 UTC

This package is not auto-updated.

Last update: 2024-09-21 04:59:30 UTC


README

处理数组点符号的辅助函数

安装

composer require mirkoschmidt/arraydot --no-dev

示例

$array = [
    'config' =>
        'group' => [
            'setting'  => 'value',
            'setting2' => 'value2',
        ],
    ],
];

$array = array_dot($array);

// Elements can now be accessed using dot notation, like the example below.
// Echos: 'value';
echo $array['config.group.setting'];

// To return the array back to the original, the following
// line can be used.
$array = array_undot($array);

// Echos 'value2'
echo $array['config']['group']['setting2'];