PHP code example of tcdev / stingray

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

    

tcdev / stingray example snippets




//Some file needing access to array nodes

use projectmeta\Stingray\Stingray;

$stingray = new Stingray();

$someArray = array(
    'node_lvl1' => array(
        'node_lvl2' = array(
            'node_lvl3a' => true,
            'node_lvl3b' => false,
            'node_lvl3c' => array()
            )
        )
    )
);

$nodeAlias = 'node_lvl1.node_lvl2.node_lvl3a';

$newValue = false;

// return true
$stingray->get($someArray, $nodeAlias);

// change true to false
$stingray->set($someArray, $nodeAlias, $newValue);