PHP code example of hxari / tree

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

    

hxari / tree example snippets



use Tree\Tree;

// If you use Composer.
ree/Tree.php";

// If you use Wget.
     'id' => 2288,
            'profile' => [
                'fname' => "Xyz",
                'uname' => "xyz"
            ]
        ],
        [
            'id' => 2289,
            'profile' => [
                'fname' => "Xxx",
                'uname' => "xxx"
            ]
        ]
    ],
    'malware' => [
        'trojan' => "Horse"
    ]
];

// Creating a tree structure.
echo Tree::create( $array );

Tree::create( Array $data, Int $start = 0, Int $flags = 0 )


// Method.
Tree::setKeyHandler( Callable $handler );

// Method Use.
Tree::setKeyHandler( fn( Mixed $key ) => "\e[1;32m{$key}" );

// Or
Tree::setKeyHandler( function( Mixed $key ) {
    // Something....
});