PHP code example of furiosojack / mr-binary-tree

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

    

furiosojack / mr-binary-tree example snippets


$ips = [
          '255.168.0.1',
            '172.6.0.1',
            '172.0.0.1',
            '201.0.0.0'
        ];
$i=0;
$tree = new MrBinaryTree();
foreach ($ips as $address){
            $keyAdress = $i;
            $tree->addNode($keyAdress, $address);
			$i++;
        }
		
$tree->inAsc($tree->getRoot());
//Deprecated
echo $tree->getLisOrderedList();

var_dump($tree->getNodesOrdered());