The Ds\Vector::sort() function is an inbuilt function in PHP which is used to sort the elements of vector in-place. This will arrange the vector elements in increasing order.
void public Ds\Vector::sort( $comparator )
Parameters: This function accepts a single parameter $comparator which is used to hold the sort function.
Return Value: This function does not returns any value.
Below programs illustrate the Ds\Vector::sort() function in PHP:
Original vector Ds\Vector Object (  => 6  => 5  => 4  => 3  => 2  => 1 ) Sorted elements Ds\Vector Object (  => 1  => 2  => 3  => 4  => 5  => 6 )
Original vector Ds\Vector Object (  => 3  => 6  => 1  => 2  => 9  => 7 ) Decreasing Sorted elements Ds\Vector Object (  => 9  => 7  => 6  => 3  => 2  => 1 )
- p5.js | sort() function
- PHP | sort() Function
- PHP | Ds\Map sort() Function
- PHP Ds\Set sort() Function
- Node.js | sort() function
- PHP | Ds\Sequence sort() Function
- PHP | Ds\Deque sort() Function
- p5.js | Quick Sort
- p5.js | Bubble 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 email@example.com. 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.