1. Go to this page and download the library: Download wazsmwazsm/kit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wazsmwazsm / kit example snippets
use Kit\DotArr;
$arr = [];
DotArr::dotSet($arr, 'foo.bar', 'hello');
var_dump($arr); // result is ['foo' => ['bar' => 'hello']]
use Kit\DotArr;
$arr = ['foo' => ['bar' => 'hello']];
$result = DotArr::dotGet($arr, 'foo.bar');
var_dump($result); // result is hello
$result = DotArr::dotGet($arr, 'foo');
var_dump($result); // result is ['bar' => 'hello']
// 获取值不存在返回默认值
$result = DotArr::dotGet($arr, 'a.b', 'd');
var_dump($result); // result is d
use Kit\DotArr;
$arr = ['foo' => ['bar' => 'hello']];
$result = DotArr::dotHas($arr, 'foo.bar');
var_dump($result); // result is true
$result = DotArr::dotHas($arr, 'a.b');
var_dump($result); // result is false
use Kit\DotArr;
DotArr::setOperator('/');
$arr = [];
DotArr::dotSet($arr, 'foo/bar', 'hello');
$result = DotArr::dotGet($arr, 'foo/bar');
var_dump($result); // result is hello