multi dimensional array in random order

后端 未结 4 1624
谎友^
谎友^ 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:22

    It works perfect. print_r(shuffle($slides))) gives the output of TRUE, since the return value of shuffle is a boolean and not an array.

    See the working example here: http://codepad.org/B5SlcjGf

提交回复
热议问题