A simple class with provides Circular linked list data structure for your next PHP applications
Download the CircularLinkedList.php
file and place it to an appropriate directory of project and then simply include the file:
require_once 'CircularLinkedList.php';
You can create a circular linked list object and use the class functions to add and read items:
$cll = new CircularLinkedList();
To push a single item:
$cll->push($item);
To push an array of items:
$cll->push_array(array($item1, $item2));
To find and point to a specific item:
$cll->find($item);
To point to the next item and get it:
$cll->getNext();
To get the length of the linked list:
$cll->length();
To see content of the whole list:
$cll->printList($item);