How to sort random array in PHP

Asked

Viewed 73 times

0

Hello guys I’m having a hard time sorting this array with values of sub arrays so that whenever the script is called comes with different values randomly?

This is the normal array:

$results = array (0 => array 1 => int 5, 1 => array 2 => int 3, 2 => array 8 => int 5);

Ex: Script Wheel first time come

$results = array (1 => array 2 => int 3, 0 => array 1 => int 5, 2 => array 8 => int 5);

Ex: Script Wheel second time come

$results = array (2 => array 8 => int 5, 1 => array 2 => int 3, 0 => array 1 => int 5);

And so on and so forth!

1 answer

1


I think this question is duplicate, as I did not find in the network... You seek the function shuffle

$numbers = array(array(1),array(2),array(5),array(10),array(20),array(3),array(4),array(60));
var_dump($numbers);
echo "<br/>";
shuffle($numbers);
var_dump($numbers);
  • That same straight guy worked out That’s really thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.