数组随机播放[PHP]

时间:2019-03-17 16:38:09

标签: php arrays shuffle

我想以复杂的格式打印索引,但是我没有成功。

$forExample = '{"sik1":"hello","sik2":"world","sik10":"today","sik41":"yesterday"}';

    $test = json_decode($forExample);
    shuffle($test);
    foreach ($test as $key => $value){

        echo $key, ' => ', $value;
        echo '<br>';

    }

结果:

sik1 => hello
sik2 => world
sik10 => today
sik41 => yesterday

错误在哪里?

0 个答案:

没有答案