(Available since version 1.0)
LinkedList::__construct — Constructs a new singly linked list
This constructs a new empty singly linked list.
This function has no parameters.
No value is returned.
Example #1 LinkedList::__construct() example
<?php
require 'vendor/autoload.php'; // A PSR-4 or PSR-0 autoloader
use SEIDS\LinkedLists\Singly\LinkedList;
$sll = new LinkedList();
$sll->push(2);
$sll->push(3);
$sll->unshift(5);
foreach($sll as $item) echo $item."\n";
?>
The above example will output:
5 2 3