PHP Ds\Stack Functions Complete Reference
Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). The Ds\Stack uses Ds\Vector internally.
Requirements: PHP 7 is required for both extension and the compatibility polyfill.
Installation: The easiest way to install data structure by using the PECL extension.
pecl install ds
Example: Below programs illustrate the Ds\Stack::pop() function in PHP:
Ds\Stack Object (  => GfG  => to  => Welcome ) GfG Ds\Stack Object (  => to  => Welcome )
Complete list of data structure DS\Stack:
|clear()||Remove all elements from a Stack and clear it|
|copy()||Create a shallow copy of the original stack and return the copied stack.|
|isEmpty()||Check whether a Stack is empty or not.|
|peek()||Get the element present at the top of the Stack instance.|
|pop()||Remove the element present at the top of the Stack instance.|
|push()||Add elements at the end of the stack|
|toArray()||Convert the stack to an array and returns the converted array.|
My Personal Notes arrow_drop_up
Please Login to comment...