Displaying and Randomising php Arrays

后端 未结 4 622
庸人自扰
庸人自扰 2021-01-22 10:04

I have an array displaying results as below:

Array
(
    [0] => 71
    [1] => 56
    [2] => 64
    [3] => 82
    [4] => 90
    [5] => 80
    [6         


        
4条回答
  •  庸人自扰
    2021-01-22 10:45

    I would go with shuffle to randomize the arrays, as per getting the 5 elements of teh array, it really depends on your need, what do you exactly want to accomplish, getting the first 5 elements, the last ones, or some other logic.

提交回复
热议问题