The Ds\Sequence::pop() function is an inbuilt function in PHP which removes the last value from sequence and return it.
Syntax:
abstract public Ds\Sequence::pop( void ) : mixed
Parameters: This function does not accept any parameter.
Return Value: This function returns the popped value.
Below programs illustrate the Ds\Sequence::pop() function in PHP:
Program 1:
<?php // Create new sequence $seq = new \Ds\Vector( [12, 15, 18, 20] ); // pop the sequence element var_dump($seq->pop()); // pop the sequence element var_dump($seq->pop()); // pop the sequence element var_dump($seq->pop()); // pop the sequence element var_dump($seq->pop()); ?> |
Output:
int(20) int(18) int(15) int(12)
Program 2:
<?php // Create new sequence $seq = new \Ds\Vector([12, 15, 18, 20]); for ($i = 0; $i < 4; $i++) { // Pop the sequence element var_dump($seq->pop()); } ?> |
Output:
int(20) int(18) int(15) int(12)
Reference: http://php.net/manual/en/ds-sequence.pop.php
Recommended Posts:
- PHP | Ds\Deque pop() Function
- PHP | Ds\Vector pop() Function
- PHP | Ds\Stack pop() Function
- PHP Ds\PriorityQueue pop() Function
- PHP Ds\Queue pop() Function
- PHP | SplDoublyLinkedList pop() Function
- PHP | ImagickDraw pop() Function
- How to pop an alert message box using PHP ?
- Node.js | pop() function
- JavaScript Array pop() Method
- p5.js | Pop Operation in Stack
- How to create a pop-up to print dialog box using JavaScript?
- TypeScript | Array pop() Method
- How to create automatic pop-up using jQuery ?
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

