rwillians/stingray

此包已被废弃,不再维护。未建议替代包。

PHP中多维数组的点表示法读写器。

2.1.0 2016-04-11 13:35 UTC

This package is not auto-updated.

Last update: 2020-01-24 15:36:18 UTC


README

PHP中多维数组的点表示法读写器。

通过Composer安装

将Stingray添加到您的项目

$>  composer.phar require rwillians/stingray ^2.0

或直接添加到composer.json文件中

{
    "require": {
        "rwillians/stingray": "^2.0"
    }
}

然后更新您的依赖项

$>  composer.phar update

示例用法

从数组中获取任何节点

use Rwillians\Stingray\Stingray;

$someArray = array(
    'client' => array(
        'name' = 'John Doe'
    )
);

// Getting a value using dot notation:
echo Stingray::get($someArray, 'client.name'); // Outputs: 'John Doe'

// Changing a value using dot notation:
Stingray::set($someArray, 'client.name', 'Jane Doe');

// Create a new key-value to an existent array using dot notation:
Stingray::set($someArray, 'client.address', 'Some Street, 123');