Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jean-Sébastien Goupil  >  Double-Linked List  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example File
Class: Double-Linked List
Manage circular double-linked lists of objects
Author: By
Last change:
Date: 2006-03-11 15:57
Size: 576 bytes
 

Contents

Class file image Download
<?php
// Normally, all functions are templated. But in PHP,
// it is already templated.

include_once "list.php";

$a = new TList;
$a->addNode(20);    // Add 20
$a->addNode(30);    // Add 30
$a->addNode(40);    // Add 40
$a->addNode(50);    // Add 50
$a->addNode(100);    // Add 100
$a->prevCurrent();    // Select Previous (50)
$a->RemoveNode();    // Remove Current (50). 100 is Selected
$a->nextCurrent();    // Select Next (20)
$a->nextCurrent();    // Select Next (30)
$a->addNode(35);    // Add 35 (next to 30)
$a->nextCurrent();    // Select 40
echo $a->getCurrent();    // Return 40
?>