PHP Classes

File: example.php

Recommend this page to a friend!
  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: 18 years ago
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
?>