2017 © Pedro Peláez
 

library array_path_exists

Checks if the given keys or indices exists in the array

image

sk/array_path_exists

Checks if the given keys or indices exists in the array

  • Thursday, January 4, 2018
  • by skroczek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

array_path_exits

Build Status Coverage Status, (*1)

Just like the php array_key_exists function but with the possibility to give multiple keys (path)., (*2)

Installation

Download the Library

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*3)

$ composer require sk/array_path_exists "dev-master"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*4)

Usage

After installing the library the function is autoloaded by the composer autoloader., (*5)

<?php
require_once __DIR__.'/vendor/autoload.php';

$array = [
    'foo' => [
        'bar' => [
            'baz' => null
        ],
    ]
];

var_dump(array_path_exists($array, 'foo', 'bar', 'baz'));
// Print `true`

For more examples see test file under tests/ArrayPathExistsTest.php, (*6)

Running Tests

The test suite is executed by running phpunit, (*7)

vendor/bin/phpunit --bootstrap tests/bootstrap.php tests/

Issues and feature requests

Issues and feature requests are handled on github. If you found a bug, you are always welcome to open an issue. And also feel free to create a pull request with a fix. Same for feature requests., (*8)

License

This library is under the MIT license. See the complete license in the library LICENSE file., (*9)

The Versions

04/01 2018

dev-master

9999999-dev

Checks if the given keys or indices exists in the array

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Sebastian Kroczek