omissis/arrayfunctions

1.0.0 2017-02-27 07:21 UTC

This package is auto-updated.

Last update: 2024-08-26 19:45:06 UTC


README

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);

安装

您可以使用 Composer 安装 ArrayFunctions

composer require omissis/arrayfunctions

运行 composer installcomposer update 即可开始使用。