2017 © Pedro Peláez
 

library array-fold

Fold all elements of a multidimentional array down to a single level.

image

aviator/array-fold

Fold all elements of a multidimentional array down to a single level.

  • Saturday, November 25, 2017
  • by danielsdeboer
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Latest Stable Version License Build Status, (*1)

Overview

array_fold() takes an multidimensional array of any depth and recursively folds each level into the previous, flattening it to a single level., (*2)

By default it preserves (and overwrites) keys, though this can be disabled with the optional second parameter., (*3)

Installation

Via Composer:, (*4)

composer require aviator/array-fold

Testing

Via Composer:, (*5)

composer test

Usage

$array = [
    'level1' [
        'some' => 'value',
        'someOther' => 'value',
        'level2' => [
            'someOther' => 'value'
        ]
    ]
];

// Using keys
echo array_fold($array);

/*
 [
    'some' => 'value',
    'someOther' => 'value',
 ]
*/

// Ignoring keys
echo array_fold($array, false);

/*
 [
    'value',
    'value',
    'value',
 ]
*/

Other

License

This package is licensed with the MIT License (MIT)., (*6)

The Versions

25/11 2017

dev-master

9999999-dev https://github.com/danielsdeboer/array-fold

Fold all elements of a multidimentional array down to a single level.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

php arrays php7 functional

25/11 2017

0.1.0

0.1.0.0 https://github.com/danielsdeboer/array-fold

Fold all elements of a multidimentional array down to a single level.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

php arrays php7 functional