RE: [PHP4BETA] Linked lists and binary trees

From: Date: Thu, 25 May 2000 09:09:43 +0000
Subject: RE: [PHP4BETA] Linked lists and binary trees
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-15726@lists.php.net to get a copy of this message
Hi, You can implement them using class's and the '&' operator. See the Variables section in the manual for an explaination of '&'. Example: <?php class LinkedList { var $link; var $name; } $foobarOne = new LinkedList; $foobarOne->link = NULL; $foobarOne->name = "Foobar One"; $foobarTwo = new LinkedList; $foobarTwo->link = &$foobarOne; $foobarTwo->name = "Foobar Two"; echo $foobarTwo->link->name; ?> Should output "Foobar One" If there's a better way, please enlighten me. :) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Philip Murray phil@gamezone.co.nz philip.murray@clear.net.nz "To understand recursion, first we must understand recursion" -- Anon

« previous php.version4 (#15726) next »