Skip to content
Advertisement

How to generate a random number array and sorting this array using php?

I want to generate 5 random number array and shorting this array using php like the image.

I am using this code that generate 1 array.

JavaScript

Advertisement

Answer

Use this code and take a look at my comments within the code:

JavaScript

Now you have 2 arrays having same elements, but one array is sorted:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement