A object oriented approach to handling arrays in PHP. It attempts to combine Ruby (enumerator/array/hash) methods as well as built in PHP functions.
<?php
use prettyArray\PrettyArray;
$arr = new PrettyArray(range(1,6));
$arr->group_by_(function($key, &$value) {
return ($value % 3);
});
print_r($arr->to_a());
?>
Array
(
[0] => Array
(
[0] => 3
[1] => 6
)
[1] => Array
(
[0] => 1
[1] => 4
)
[2] => Array
(
[0] => 2
[1] => 5
)
)
More examples can be found inside of the "/examples" directory in markdown format which is viewable on Github.
git clone git://github.com/BlaineSch/prettyArray.git
# OR
git submodule add git://github.com/BlaineSch/prettyArray.git
"require": {
"blainesch/prettyarray": "1.0.0"
}
php compooser.phar install
Before making any pull requests please verify that your methods pass the current unit tests.
cd PrettyArray && phpunit
PHPUnit 3.6.12 by Sebastian Bergmann.
Configuration read from /Users/blaineschmeisser/Sites/devup/PrettyArray/phpunit.xml
............................................................... 63 / 159 ( 39%)
............................................................... 126 / 159 ( 79%)
.................................
Time: 1 second, Memory: 10.00Mb
OK (159 tests, 180 assertions)