PHP | SplDoublyLinkedList __construct() Function Last Updated : 07 Mar, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The SplDoublyLinkedList::__construct() function is an inbuilt function in PHP which is used to create a new empty doubly linked list. Syntax: public SplDoublyLinkedList::__construct( void ) Parameters: This function does not accept any parameter. Return Value: This function does not return any value. Below programs illustrate the SplDoublyLinkedList::__construct() function in PHP: Program 1: php <?php // Declare an empty SplDoublyLinkedList $list = new SplDoublyLinkedList(); // Push the element into SplDoublyLinkedList $list->push(10); $list->push(20); $list->push(30); // Display the SplDoublyLinkedList var_dump($list); ?> Output: object(SplDoublyLinkedList)#1 (2) { ["flags":"SplDoublyLinkedList":private]=> int(0) ["dllist":"SplDoublyLinkedList":private]=> array(3) { [0]=> int(10) [1]=> int(20) [2]=> int(30) } } Program 2: php <?php // Declare an empty SplDoublyLinkedList $list = new SplDoublyLinkedList(); // Add the element into SplDoublyLinkedList $list->add(0, "Welcome"); $list->add(1, "to"); $list->add(2, "GeeksforGeeks"); $list->add(3, "A"); $list->add(4, "Computer"); $list->add(5, "Science"); $list->add(6, "Portal"); // Display the SplDoublyLinkedList var_dump($list); ?> Output: object(SplDoublyLinkedList)#1 (2) { ["flags":"SplDoublyLinkedList":private]=> int(0) ["dllist":"SplDoublyLinkedList":private]=> array(7) { [0]=> string(7) "Welcome" [1]=> string(2) "to" [2]=> string(13) "GeeksforGeeks" [3]=> string(1) "A" [4]=> string(8) "Computer" [5]=> string(7) "Science" [6]=> string(6) "Portal" } } Comment More infoAdvertise with us Next Article PHP SplDoublyLinkedList count() function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- SplDoublyLinkedList Similar Reads PHP SplDoublyLinkedList count() function The SplDoublyLinkedList::count() function is an inbuilt function in PHP which is used to count the number of elements present in a doubly linked list. Syntax: int SplDoublyLinkedList::count( void ) Parameters: It does not contain any parameter. Return Value: It returns the number of elements present 1 min read PHP SplDoublyLinkedList current() Function The SplDoublyLinkedList::current() function is an inbuilt function in PHP which is used to returns the current element of the array. Syntax: mixed SplDoublyLinkedList::current( void ) Parameters: It does not accepts any parameter. Return Value: It returns the current node value of doubly linked list 1 min read PHP SplDoublyLinkedList key() Function The SplDoublyLinkedList::key() function is an inbuilt function in PHP which is used to return the index of the current node. Syntax: mixed SplDoublyLinkedList::key( void ) Parameters: This function does not accepts any parameters. Return Value: It returns the index of current node. Below programs il 1 min read PHP SplDoublyLinkedList pop() Function The SplDoublyLinkedList::pop() function is an inbuilt function in PHP which is used to pop the node from the end of the doubly linked list. Syntax: mixed SplDoublyLinkedList::pop( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the value of a popp 1 min read PHP SplDoublyLinkedList top() Function The SplDoublyLinkedList::top() function is an inbuilt function in PHP which is used to return the value of last (top) node in a doubly-linked list. Syntax: mixed SplDoublyLinkedList::top( void ) Parameters: This function does not accepts any parameters. Return Value: It returns the value of last nod 1 min read PHP SplDoublyLinkedList prev() Function The SplDoublyLinkedList::prev() function is an inbuilt function in PHP which is used to move to the previous entry. Syntax: void SplDoublyLinkedList::prev( void ) Parameters: This function does not accepts any parameters. Return Value: It does not return any value. Below programs illustrate the SplD 1 min read Like