dev-master
9999999-devLibrary that allows you tu use arrays as keys for arrays!
MIT
The Requires
by Omran Jamal
v0.9.0
0.9.0.0Library that allows you tu use arrays as keys for arrays!
MIT
The Requires
by Omran Jamal
Library that allows you tu use arrays as keys for arrays!
Allowing you to use arrays as keys for associative arrays. Only supports flat arrays of scalar values., (*1)
composer require hedronium/key-array
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
Library that allows you tu use arrays as keys for arrays!
MIT
Library that allows you tu use arrays as keys for arrays!
MIT