Object-problem

From: Date: Sat, 02 Sep 2000 19:24:32 +0000
Subject: Object-problem
Groups: php.general 
Request: Send a blank email to php-general+get-14943@lists.php.net to get a copy of this message
Hello ! Another problem of this kind: Could someone tell me, why this is outputting "No" and what I can do about it ? Regards Martin <?php $root = new MenuItem(0); $temp = new MenuItem($root); $root->AddChild($temp); $s = $root->findFile(""); if ($s == $temp) print "Ok"; else print "No"; class MenuItem { var $parent; // Parent of the item var $childs = array(); // All Child-Items // Konstruktor function MenuItem($parent) { $this->parent = $parent; } // Adds a Child function AddChild(&$childItem) { array_push($this->childs, $childItem); $childItem->parent = $this; } function findFile($fileName) { return $this->childs[0]; } } ?>

« previous php.general (#14943) next »