2017 © Pedro Peláez
 

library arraypath

Coercive Utility ArrayPath

image

coercive/arraypath

Coercive Utility ArrayPath

  • Wednesday, February 7, 2018
  • by Coercive
  • Repository
  • 1 Watchers
  • 2 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Coercive ArrayPath

  • Cross a table like a file path.

Get

composer require coercive/arraypath

Class

use Coercive\Utility\ArrayPath\ArrayPath;

# EXAMPLE
$example_array = [
    '1' => [
        '2' => [
            '3' => [
                'content'
            ]
        ]
    ]
];

# INIT OBJECT
$handler = ArrayPath::init($example_array);

# RETRIEVE CONTENT
$content = $handler->get('1.2.3');
$content = $handler->get('1.2.3.4', '-- null or not exist --');

# VERIFY PATH EXIST
if($handler->has('1.2.3')) {
    // ...
}

# OR get and check in same time
$content = $handler->get('1.2.3.4', null, $exist);
if(!$exist) {
    // ...
}

# SET VALUE
$handler->set('1.2.3', ['new-content']);

# DELETE PATH
$handler->delete('1.2.3');

# RESET
$handler->reset();

# OPTION : custom separator
$handler->setSeparator('@');
$content = $handler->get('1@2@3');

The Versions

07/02 2018

dev-master

9999999-dev http://coercive.fr

Coercive Utility ArrayPath

  Sources   Download

MIT GNU

The Requires

  • php >=7

 

07/02 2018

0.0.2

0.0.2.0 http://coercive.fr

Coercive Utility ArrayPath

  Sources   Download

MIT

The Requires

  • php >=7

 

05/06 2017

0.0.1

0.0.1.0 http://coercive.fr

Coercive Utility ArrayPath

  Sources   Download

GNU

The Requires

  • php >=7