PHP code example of arth / traverse

1. Go to this page and download the library: Download arth/traverse 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/ */

    

arth / traverse example snippets


use Arth\Util\Traverse as T;

$data = ['a' => ['b' => ['c' => 'Hello', 'd' => null]]];

$svc = new T\Service('->');

$svc->has('a->b->c', $data); // true
$svc->get('a->b->c', $data); // 'Hello'

$container = new T\Container($data);
$container['a.b']; // ['c' => 'Hello']
isset($container['a.b.d']); // false

$w = new T\Wrapper($data);
$w['a']['b.c']->getValue(); // 'Hello'