PHP Ds\Stack Functions Complete Reference Last Updated : 25 Jan, 2023 Comments Improve Suggest changes Like Article Like Report 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 Syntax: public Ds\Stack::functionName() Example: Below programs illustrate the Ds\Stack::pop() function in PHP: PHP <?php // PHP program to illustrate the // Ds\stack::pop() function // Create a Stack instance $stack = new \Ds\Stack(); // Pushing elements to Stack $stack->push("Welcome"); $stack->push("to"); $stack->push("GfG"); // Print the initial Stack print_r($stack); // Print the top element and remove it print_r($stack->pop()); // Print the Stack again print_r($stack); ?> Output: Ds\Stack Object ( [0] => GfG [1] => to [2] => Welcome ) GfG Ds\Stack Object ( [0] => to [1] => Welcome ) Complete list of data structure DS\Stack: Functions Description clear()Remove all elements from a Stack and clear itcopy()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 stacktoArray()Convert the stack to an array and returns the converted array. Comment More infoAdvertise with us Next Article PHP DsQueue Functions Complete Reference S Sabya_Samadder Follow Improve Article Tags : Web Technologies PHP PHP-ds_stack Similar Reads PHP String Functions Complete Reference Strings are a collection of characters. For example, 'G' is the character and 'GeeksforGeeks' is the string. Installation: These functions are not required any installation. These are the part of PHP core. The complete list of PHP string functions are given below: Example: This program helps us to c 6 min read PHP DsStack 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. Inst 2 min read PHP DsQueue Functions Complete Reference A Queue is a linear data structure that follows a particular order in which the operations are performed. The order of queue is First In First Out (FIFO). Requirements: PHP 7 is required for both extension and the compatibility polyfill. Installation: The easiest way to install data structure by usi 2 min read PHP intl Functions Complete Reference The Complete list of PHP intl Functions are listed below: Collator PHP collator_asort() FunctionPHP collator_compare() FunctionPHP Collator __construct() FunctionPHP Collator create() FunctionPHP collator_sort_with_sort_keys() FunctionPHP collator_sort() Function IntlCalendar PHP IntlCalendar add() 1 min read PHP Math Functions Complete Reference The predefined math functions in PHP are used to handle the mathematical operations within the integer and float types. These math functions are part of the PHP core. Installation: These functions have not required any installation. The complete list of PHP math functions are given below:Example: Pr 3 min read PHP Filesystem Functions Complete Reference The Filesystem function is used to access and manipulate filesystem. It is the part of PHP code so no need to install these functions. For accessing the files on the system, the file path will be used. On Unix system, forward slash (/) is used as a directory separator and on Windows platform, both f 4 min read Like