https://github.com/omissis/arrayfunctions
Functions to manipulate PHP arrays
https://github.com/omissis/arrayfunctions
Last synced: about 1 month ago
JSON representation
Functions to manipulate PHP arrays
- Host: GitHub
- URL: https://github.com/omissis/arrayfunctions
- Owner: omissis
- Created: 2017-02-26T23:25:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-27T07:30:15.000Z (over 8 years ago)
- Last Synced: 2025-09-06T10:42:32.540Z (about 1 month ago)
- Language: PHP
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ArrayFunctions
PHP Utilities to operate on arrays.
```php
use Omissis\ArrayFunctions;
use function Omissis\ArrayFunctions\get as array_get;
use function Omissis\ArrayFunctions\set as array_set;// Retrieve a value by its key, optionally returning a default if the value is not found.
// $key can be a string or an array representing the path to the key you are interested into.
ArrayFunctions\get($array, $key, $default);// Alternatively, use the function alias
array_get($array, $key, $default);// Set the value of a key, returning the previous value if it was set.
// $key can be a string or an array representing the path to the key you are interested into.
ArrayFunctions\set($array, $key, $value)// Alternatively, use the function alias
array_set($array, $key, $value);
```## Installation
You can install ArrayFunctions with Composer:
```
composer require omissis/arrayfunctions
```Run `composer install` or `composer update` and you're ready to start.