multi dimensional array in random order

后端 未结 4 1639
谎友^
谎友^ 2020-12-02 01:43

I want to make it so that my multi dimensional array is in a random order. How would you do it?

// This is how the array looks like
print_r($slides);

Array
         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 02:32

    Instead of

    print_r(shuffle($slides));
    

    do

    shuffle($slides);
    print_r($slides);
    

    You see shuffle() shuffles the array in-place

提交回复
热议问题