PHP Classes

File: examples.php

Recommend this page to a friend!
  Classes of Biswarup Adhikari   PHP Linked List   examples.php   Download  
File: examples.php
Role: Example script
Content type: text/plain
Description: PHPLinkedList Examples
Class: PHP Linked List
Manage elements stored in a linked list
Author: By
Last change:
Date: 8 years ago
Size: 889 bytes
 

Contents

Class file image Download
<?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);
// }