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.
mixed SplDoublyLinkedList::top( void )
Parameters: This function does not accepts any parameters.
Return Value: It returns the value of last node in a doubly linked list.
Below programs illustrate the SplDoublyLinkedList::top() function in PHP:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.