2017 © Pedro Peláez
 

library key-array

Library that allows you tu use arrays as keys for arrays!

image

hedronium/key-array

Library that allows you tu use arrays as keys for arrays!

  • Friday, December 23, 2016
  • by hedronium
  • Repository
  • 3 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

KeyArray

Allowing you to use arrays as keys for associative arrays. Only supports flat arrays of scalar values., (*1)

Installation

composer require hedronium/key-array

Usage

Just Instantiate the class, or call the KeyArray::array() method to instantiate it., (*2)

use Hedronium\KeyArray\KeyArray;

$arr = new KeyArray;

// or
$arr = KeyArray::array();

then proceed to use it like a normal array., (*3)

$arr[[]]              = 'The void in my heart.';
$arr[['a']]           = 'AYY';
$arr[['b']]           = 'BEE';
$arr[['a', 'b']]      = 'AYY-BEE';
$arr[['a', 'b', 'c']] = 'AYY-BEE-CEE';

iteration with foreach works too., (*4)

foreach ($arr as $key => $val) {
    echo str_pad(implode(' -> ', $key), 20, ' ', STR_PAD_LEFT);
    echo ' = ';
    echo $val;
    echo PHP_EOL;
}

////// OUTPUT: /////////////////////////
//             = The void in my heart.
//           a = AYY
//      a -> b = AYY-BEE
// a -> b -> c = AYY-BEE-CEE
//           b = BEE

The Versions

23/12 2016

dev-master

9999999-dev

Library that allows you tu use arrays as keys for arrays!

  Sources   Download

MIT

The Requires

 

23/12 2016

v0.9.0

0.9.0.0

Library that allows you tu use arrays as keys for arrays!

  Sources   Download

MIT

The Requires