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 )
- CSS | rotate() Function
- p5.js | rotate() function
- CSS | hue-rotate() Function
- PHP | Ds\Deque rotate() Function
- PHP | ImagickDraw rotate() Function
- PHP | GmagickDraw rotate() Function
- Node.js | GM 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 rotate a text canvas using Fabric.js ?
- How to Rotate Container Background Image using CSS ?
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.