2017 © Pedro Peláez
 

library arr

The Array Component contains methods that can be useful when working with arrays.

image

flextype-components/arr

The Array Component contains methods that can be useful when working with arrays.

  • Thursday, May 31, 2018
  • by Awilum
  • Repository
  • 1 Watchers
  • 0 Stars
  • 103 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 49 % Grown

The README.md

Arr Component

Version License Total downloads , (*1)

The Array Component contains methods that can be useful when working with arrays., (*2)

Installation

composer require flextype-components/arr

Documentation

Class: \Flextype\Component\Arr\Arr

Visibility Function
public static average(array $array, int/\integer $decimals) : int/\Flextype\Component\Arr\double
Returns the average value of the current array.
public static createFromJson(\string $json, \boolean $assoc=true, \integer $depth=512, int/\integer $options) : array
Create an new Array from JSON string.
public static createFromString(\string $str, \string $delimiter=null, \string $regEx=null) : array
Create an new Array object via string.
public static delete(array $array, \string $path) : mixed
Deletes an array value using "dot notation".
public static dot(array $array, \string $prepend='') : array
Flatten a multi-dimensional associative array with dots.
public static first(array $array) : mixed The first element
Returns the first element of an array
public static get(array $array, \string $path, mixed $default=null) : mixed
Returns value from array using "dot notation". If the key does not exist in the array, the default value will be returned instead.
public static isAssoc(array $array) : bool
Returns TRUE if the array is associative and FALSE if not.
public static keyExists(array $array, mixed $path) : bool
Checks if the given dot-notated key exists in the array.
public static last(array $array) : mixed The last element
Returns the last element of an array
public static overwrite(array $array1, array $array2) : array
Overwrites an array with values from input arrays. Keys that do not exist in the first array will not be added!
public static random(array $array) : mixed
Returns a random value from an array.
public reverse(array $array, \boolean $preserve_keys=false) : array
Return an array with elements in reverse order. Non-numeric keys are not affected by this setting and will always be preserved.
public static set(array $array, \string $path, mixed $value) : void
Sets an array value using "dot notation".
public static size(array $array, int/\integer $mode) : void
Counts all elements in an array. COUNT_RECURSIVE (or 1), count will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array. count does not detect infinite recursion.
public static sort(array $array, \string $field, \string $direction='ASC', \Flextype\Component\Arr\const $method) : array
Sorts a multi-dimensional array by a certain field path
public static toJson(array $array, int/\integer $options, \integer $depth=512) : string The JSON string
Converts an array to a JSON string
public static undot(array $array) : array
Expands a dot notation array into a full multi-dimensional array.

LICENSE

The MIT License (MIT) Copyright (c) 2020 Sergey Romanenko, (*3)

The Versions

31/05 2018

dev-master

9999999-dev https://github.com/flextype-components/arr

The Array Component contains methods that can be useful when working with arrays.

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

array

31/05 2018

v1.2.3

1.2.3.0 https://github.com/flextype-components/arr

The Array Component contains methods that can be useful when working with arrays.

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

array

30/04 2018

v1.2.2

1.2.2.0 https://github.com/flextype-components/arr

The Array Component contains methods that can be useful when working with arrays.

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

array

26/04 2018

v1.2.1

1.2.1.0 https://github.com/flextype-components/arr

The Array Component contains methods that can be useful when working with arrays.

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

array

26/04 2018

v1.2.0

1.2.0.0 https://github.com/flextype-components/arr

The Array Component contains methods that can be useful when working with arrays.

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

array

11/04 2018

v1.1.1

1.1.1.0 https://github.com/flextype-components/array

The Array Component contains methods that can be useful when working with arrays.

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

array

05/04 2018

v1.1.0

1.1.0.0 https://github.com/flextype-components/array

The Array Component contains methods that can be useful when working with arrays.

  Sources   Download

MIT

The Requires

  • php ^7.1.3

 

array

27/10 2015

v1.0.2

1.0.2.0 https://github.com/force-components/Arr/issues

Simple Array Class

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array