Simple binary tree implementation in PHP.
composer require angle/tree
Creating a tree:
use Angle\Tree\Leaf;
$tree = new Leaf(10);
$tree->insert(5);
$tree->insert(15);
$tree->insert(8);
Check for values within the tree:
$tree->contains(5); // true
$tree->contains(42); // false
Climb the tree:
$tree->left->right->data == 8; // true
Improvements are welcome! Feel free to submit pull requests.
MIT
Copyright © 2019 Angle Software