PHP | Ds\Set last() Function
The Ds\Set::last() function is an inbuilt function in PHP which is used to return the last element from the Set instance.
Syntax:
void public Ds\Set::last( void )
Parameter: This function does not accepts any parameter.
Return Value: This function returns the last value of the Set.
Below programs illustrate the Ds\Set::last() function in PHP:
Program 1:
<?php // PHP program to illustarte the // last() function // Create a set instance $set = new \Ds\Set(); // Adding elements to Set $set->add("Welcome"); $set->add("to"); $set->add("GfG"); // Print the last element from set print_r($set->last()); ?> |
chevron_right
filter_none
Output:
GfG
Program 2:
<?php // PHP program to illustarte the // last() function // Create a set instance $set = new \Ds\Set(); // Adding elements to Set $set->add("10"); $set->add("20"); $set->add("30"); // Print the last element from set print_r($set->last()); ?> |
chevron_right
filter_none
Output:
30
Reference: http://php.net/manual/en/ds-set.last.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- D3.js | d3.map.set() Function
- D3.js | d3.min() function
- p5.js | nf() Function
- p5.js | nfc() function
- p5.js | hex() function
- PHP | pi( ) Function
- PHP | pow( ) Function
- D3.js | d3.hsl() Function
- CSS | var() Function
- p5.js | box() Function
- D3.js | d3.max() function
- p5.js | str() function
- p5.js | cos() 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.



