The Ds\Deque::sort() function is an inbuilt function in PHP which is used to sort the Deque in place by arranging the elements in increasing order.
public Ds\Deque::sort( $comparator ) : void
Parameters::This function accepts single parameter $comparator which holds the function to decides how to sort the elements. It helps in customizing the sort function.
Return Value: This function does not return any value.
Below programs illustrate the Ds\Deque::sort() function in PHP:
Elements of Deque Ds\Deque Object (  => 5  => 6  => 3  => 2  => 7  => 1 ) Sorted Deque Ds\Deque Object (  => 1  => 2  => 3  => 5  => 6  => 7 )
Elements of Deque Ds\Deque Object (  => 5  => 6  => 3  => 2  => 7  => 1 ) Sorted Deque Ds\Deque Object (  => 7  => 6  => 5  => 3  => 2  => 1 )
- PHP Ds\Set sort() Function
- p5.js | sort() function
- PHP | Ds\Map sort() Function
- PHP | sort() Function
- PHP | Ds\Sequence sort() Function
- PHP | Ds\Vector sort() Function
- p5.js | Bubble Sort
- p5.js | Quick Sort
- Sort an array of dates in PHP
- How to sort a list alphabetically using jQuery ?
- Sort array of objects by object fields in PHP
- Sort a multidimensional array by date element in PHP
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.