The Ds\Vector::rotate() function is an inbuilt function in PHP which is used to rotate the array elements by a given number of rotation. Rotations also happen in-place.
void public Ds\Vector::rotate( $rotations )
Parameters: This function accepts single parameter $rotations which holds the number of rotations.
Return Value: This function does not return any value.
Below programs illustrate the Ds\Vector::rotate() function in PHP:
Original Vector Ds\Vector Object (  => 1  => 2  => 3  => 4  => 5 ) Vector after rotating by 3 places Ds\Vector Object (  => 4  => 5  => 1  => 2  => 3 )
Program 2: When number of rotations are greater than the number of elements in the vector.
Original Vector Ds\Vector Object (  => 1  => 2  => 3  => 4  => 5 ) Vector after rotating by 6 places Ds\Vector Object (  => 2  => 3  => 4  => 5  => 1 )
- p5.js | rotate() function
- CSS | hue-rotate() Function
- CSS | rotate() Function
- PHP | Ds\Deque rotate() Function
- PHP | ImagickDraw rotate() Function
- PHP | Ds\Sequence rotate() Function
- Rotate a polygon by given degrees in p5.js
- Node Jimp | rotate
- HTML canvas rotate() Method
- How to get the function name inside a function in PHP ?
- D3.js | d3.lab() Function
- PHP | exp() 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 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.