SplDoublyLinkedList::__construct

(PHP 5 >= 5.3.0, PHP 7)
Constructs a new doubly linked list
public SplDoublyLinkedList::__construct ( void )

This constructs a new empty doubly linked list.

Returns:

No value is returned.

Examples:
SplDoublyLinkedList::__construct() example
<?php
$dll = new SplDoublyLinkedList();

$dll->push(2);
$dll->push(3);
$dll->unshift(5);

var_dump($dll);
?>

The above example will output:

object(SplDoublyLinkedList)#1 (2) {
  ["flags":"SplDoublyLinkedList":private]=>
  int(0)
  ["dllist":"SplDoublyLinkedList":private]=>
  array(3) {
    [0]=>
    int(5)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
}
doc_php
2016-02-24 16:19:23
Comments
Leave a Comment

Please login to continue.