2017 © Pedro Peláez
 

library php-array-utils

Handy php array utilities.

image

timdev/php-array-utils

Handy php array utilities.

  • Thursday, February 4, 2016
  • by timdev
  • Repository
  • 1 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

timdev/php-array-utils

Everybody who writes a bunch of PHP eventually writes functions to do some common array manipulation tasks., (*1)

This is where I'm going to stick all mine. You're welcome to use them, too., (*2)

The utilities are implemented as static methods on a class., (*3)

As of today, there's only one function:, (*4)

ArrayUtils::val(array $array, $keys, $default = null)

Digs a value out of an array, or else returns a default value., (*5)

use TimDev\ArrayUtils as A;

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

// $baz == 'baz'
$baz = A::val($array, ['foo', 'bar']);

// $nope == null
$nope = A::val($array, ['foo', 'bork']);

// $nope == 'squee'
$nope = A::val($array, ['i-do-not-exist'], 'squee');

// if you're just dereferencing by one level, you can pass int/string as second arg:
// $foo == ['bar' => 'baz']
$foo = A::val($array, 'foo');  


The Versions

04/02 2016

dev-master

9999999-dev

Handy php array utilities.

  Sources   Download

MIT

The Development Requires

by Tim Lieberman

04/02 2016

0.1.1

0.1.1.0

Handy php array utilities.

  Sources   Download

MIT

The Development Requires

by Tim Lieberman

04/02 2016

0.1

0.1.0.0

Handy php array utilities.

  Sources   Download

MIT

The Development Requires

by Tim Lieberman