<?php
/**
* examples.php
* @category DataStructure
* @package PHPLinkedList Example
* @author Biswarup Adhikari <biswarupadhikari@gmail.com>
*/
require_once 'PHPLinkedList.php';
/**
* Create New LinkedList
*/
$myLinkedList=new PHPLinkedList;
//Add New Item To List
$myLinkedList->put(1);
$myLinkedList->put("Biswarup");
//Append Item
$myLinkedList->append("biswarupadhikari@gmail.com");
//Prepend Item
$myLinkedList->prepend("www.biswarupadhikari.com");
//Get First Item
var_dump($myLinkedList->first());
//Get Last Item
var_dump($myLinkedList->last());
//Get Item By Position
var_dump($myLinkedList->get(0));
var_dump($myLinkedList->get(2));
//Total Number Of Items
var_dump($myLinkedList->count());
// $i=0;
// while(true)
// {
// //$myLinkedList->printChain();
// $myLinkedList->append($i);
// var_dump($myLinkedList->count());
// $i++;
// //sleep(1);
// }
|