mirkoschmidt/arraydot

Functions to handle multidimensional arrays and dots.

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

This package is not auto-updated.

Last update: 2024-11-02 05:28:38 UTC


README

Helper functions to deal with array dotting

Installation

composer require mirkoschmidt/arraydot --no-dev

Examples

$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'];