+

PHP Ds / Set last () function

Syntax:
void public DsSet::last (void)
Parameter: this function takes no parameters.Return value:This function returns the last value of the set.The following programs illustrate the Ds / Set function: : last()in PHP:Program 1:  
// PHP illustration program
// last() function 
// Create an instance of the set $set = new DsSet();  
// Add elements to the Set $set -> add ( "Welcome" ); $set -> add ( "to" ); $set -> add ( "GfG" );  
// Print the last item in the set print_r ( $set -> last());  
?>
Exit:
GfG
Program 2:  
// PHP illustration program
// function last ( ) 
// Create an instance of the set $set = new DsSet();  
// Add elements to the Set $set -> add ( "10" ); $set -> add ( "20" ); $set -> add ( "30" );  
// Print the last item in the set print_r ( $set -> last());  
?>
Exit:
30
Link: http: // php. net / manual / en / ds-set.last.php
Get Solution for free from DataCamp guru