PHP Programming
Group for all things PHP, Coding Help, Problems and Solutions
104 Members
Join this group to post and comment.
Vijay Khatri
Vijay Khatri
Computer Science
05 Feb 2019

What is the function to randomize the items of a list in-place?

Please answer

2mos ago

Well, you could do it in a number of ways. But shuffle function is the right and easiest way to do it. PHP: shuffle - Manual

Here's an example -

$standard_array = [1,2,3,4,5,6,7];



// Outputs: [1,3,2,7,5,6,4];

The shuffle function will pick the elements of an array and then randomize them in place. 

Does that answer your question?