2017 © Pedro Peláez
 

library array-box

ArrayBox is a package to manipulate the array.

image

aiiro/array-box

ArrayBox is a package to manipulate the array.

  • Saturday, October 28, 2017
  • by aiiro
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ArrayBox

Circle CI, (*1)

ArrayBox is a PHP helper library that makes easy to manipulate the array., (*2)

Installing

PHP 5.6+ and Composer are required., (*3)

Require this package with composer using the following command., (*4)

composer require aiiro/array-box

After Composer requiring, you need to require Composer's autoload.php., (*5)

<?php 

require 'vendor/autoload.php';

Functions

\ArrayBox\ArrayBox

  • sort2Dimensional - Sort two-dimensional array using the given $first, $second parameter.
  • duplicatesInMultiDimensional - Find duplications in multi dimensional array.
  • add - Add passed value to the instance $values variable.
  • between - Retrieve the values within the given range.
  • except - Retrieve the values except for the given value.
  • only - Retrieve only the specified value in array.

Usage

Example

<?php

$data = [
            ['volume' => 67, 'edition' => 2],
            ['volume' => 86, 'edition' => 1],
            ['volume' => 85, 'edition' => 6],
            ['volume' => 98, 'edition' => 1],
            ['volume' => 86, 'edition' => 3],
            ['volume' => 86, 'edition' => 2],
            ['volume' => 67, 'edition' => 7],
        ];

$array_box = new \ArrayBox\ArrayBox($data);
$sorted = $array_box->sort2Dimensional('volume', SORT_DESC, 'edition', SORT_ASC);

// Result
[
    ['volume' => 98, 'edition' => 1],
    ['volume' => 86, 'edition' => 1],
    ['volume' => 86, 'edition' => 2],
    ['volume' => 86, 'edition' => 3],
    ['volume' => 85, 'edition' => 6],
    ['volume' => 67, 'edition' => 2],
    ['volume' => 67, 'edition' => 7],
];

License

ArrayBox is released under MIT License. See MIT License for the detail., (*6)

The Versions

28/10 2017

dev-master

9999999-dev

ArrayBox is a package to manipulate the array.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Avatar aiiro

28/10 2017

dev-add-methods

dev-add-methods

ArrayBox is a package to manipulate the array.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Avatar aiiro