Guest User

Untitled

a guest
Dec 11th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. declare(strict_types = 1);
  4.  
  5. use Graphp\GraphViz\GraphViz;
  6. use drupol\phptree\Converter\ValueGraph as Graph;
  7. use drupol\phptree\Node\ValueNode;
  8.  
  9. include './vendor/autoload.php';
  10.  
  11. $tree = new ValueNode('Bobbeh', 2);
  12.  
  13. $data = 'who is your brogy now ?';
  14.  
  15. $nodes = [];
  16. foreach (\explode(' ', $data) as $v) {
  17. $nodes[] = new ValueNode($v);
  18. }
  19.  
  20. $tree->add(...$nodes);
  21.  
  22. $graphViz = new GraphViz();
  23. $graph = new Graph();
  24.  
  25. $graphViz->display($graph->convert($tree));
Add Comment
Please, Sign In to add comment