Skip to content
array_undot (the opposite of the array_dot helper function) expands a dot notation array into a full multi-dimensional array.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Provide array_dot if it does not exist Apr 23, 2019
tests/Unit Apply fixes from StyleCI Mar 9, 2018
.coveralls.yml Add code coverage support Mar 9, 2018
.gitignore Remove illuminate/support dependency and refactor Apr 23, 2019
.travis.yml Upgrade PHP version requirements Apr 12, 2019
LICENSE Initial commit Jan 12, 2018
README.md Fix badges Apr 23, 2018
composer.json
phpunit.xml Initial commit Jan 12, 2018

README.md

array_undot

Build Status Coverage Status StyleCI Packagist

This package provides a helper function called array_undot, which expands a dot notation array into a full multi-dimensional array. It is, therefore, the opposite of the array_dot helper function provided by Laravel.

Installation

To install, just run the following composer command.

composer require divineomega/array_undot

The array_undot helper function will then be available globally in your project.

Usage

The following basic examples show how to use the array_undot helper function.

$dotNotationArray = ['products.desk.price' => 100];

$expanded = array_undot($dotNotationArray)

// ['products' => ['desk' => ['price' => 100]]];
$dotNotationArray = ['products.desk.price' => 100, 
                     'products.desk.name' => 'Oak Desk',
                     'products.lamp.price' => 15,
                     'products.lamp.name' => 'Red Lamp'];

$expanded = array_undot($dotNotationArray)

/*
[
    'products' => [
        'desk' => [
            'price' => 100,
            'name' => 'Oak Desk'
        ],
        'lamp' => [
            'price' => 15,
            'name' => 'Red Lamp'
        ]
    ]
]
*/
You can’t perform that action at this time.