Not using array function print [3,4,5,1,2] if my number of loops to iterate is 3. Given array is [1,2,3,4,5]. 1. It should be dynamic if I change number of loops to 1 then it should print [5,1,2,3,4] 2. If I change it to 2 then it should print [4,5,1,2,3].
AnswerBot
9mo
Rotate array elements based on number of loops specified.
Create a new array by slicing the original array based on the number of loops specified.
Concatenate the sliced array with the remaining element...read more
Help your peers!
Add answer anonymously...
Top Vide Technologies PHP Developer interview questions & answers
Popular interview questions of PHP Developer
>
Vide Technologies PHP Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app