All pastes #929120 Raw Edit

Stuff

public php v1 · immutable
·published 2008-03-05 15:32 UTC
rendered paste body
// Simple tree class// <Id of node> || <node name> || class Node {		private $nodeId, $nodeName;	private static $nodeList;	private static $nodeCount;		function __construct($nodeId, $nodeName) {				$this->nodeId = $nodeId; 		$this->nodeName = $nodeName;		Node::$nodeList[] = $this;		Node::$nodeCount++;	}		// function to draw nodeTree	static function draw() {		foreach(Node::$nodeList as $key => $val) {			echo $val->nodeName;			echo "<br>";		}	}	}$rootNode = new Node(0, "[-]Rootnode[-]");$omgNode = new Node(1,"lol");$subNode = new Node(0,"[+]Subnode[+]");Node::draw();?>