Giter Club home page Giter Club logo

helpers-array's Introduction

Array helpers

Build Status Test Coverage Version Licence

Table of contents

Installation

composer require weew/helpers-array

Introduction

This tiny library provides various helper functions to deal with arrays.

Functions

array_get

Get an item from an array using "dot" notation.

mixed array_get(array $array, mixed $key [, mixed $default = null])

array_has

Check if an item exists in an array using "dot" notation.

bool array_has(array $array, mixed $key)

array_set

Set an array item to a given value using "dot" notation.

array array_set(array &$array, mixed $key, mixed $value)

array_remove

Remove one or many array items from a given array using "dot" notation.

void array_remove(array &$array, mixed $keys)

array_add

Add an element to the array at a specific location using the "dot" notation.

array array_add(array &$array, mixed $key, mixed $value)

array_take

Get an element and remove it from the array using the "dot" notation.

array array_take(array &$array, mixed $key, [, mixed $default = null])

array_first

Get the first element from an array.

array array_first(array &$array, [, mixed $default = null])

array_last

Get the last element from an array.

array array_last(array &$array, [, mixed $default = null])

array_reset

Reset all numerical indexes of an array (start from zero). Non-numerical indexes will stay untouched.

array array_reset(array $array [, bool $deep = false])

array_dot

Flatten a multi-dimensional associative array with dots.

array array_dot(array $array [, string $prepend = ''])

array_extend

Extend one array with another.

array array_extend(array $arrays [, array $...])

array_extend_distinct

Extend one array with another. Non associative arrays will not be merged but rather replaced.

array array_extend_distinct(array $arrays [, array $...])

array_is_associative

Check if the given array is associative.

bool array_is_associative(array $array)

array_is_indexed

Check if an array has a numeric index.

bool array_is_indexed(array $array)

array_contains

Check if array contains a specific element.

array array_contains(array $array, mixed $search [, bool $strict = true])

helpers-array's People

Contributors

maximkott avatar

Watchers

James Cloos avatar Valentin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.