dignityinside/arr

Array helper class


Keywords
php, array
License
MIT

Documentation

Dignity Arr

Array helper class

Installation

composer require dignityinside/arr
composer install

Usage example

use Dignity\Arr;

// Retrieve a single key from an array
$username = Arr::hasKey($_POST, 'username');

// Retrieves multiple keys from an array
$auth = Arr::hasKeys($_POST, array('username', 'password'));

// Return a random element of an array
Arr::randomElement($quotes);

// Check if least one value in array is not empty
Arr::leastOneValueIsNotEmpty(['', 'apple', '']);

// Convert array to object
Arr::toObject($list);

License

This project is licensed under the MIT License. See the LICENSE file for details.