3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'one', 'two', 'three', 'four' ]; $n = 10; $lastIndex = -1; $result = []; for ($x = 0; $x < 10; ++$x) { $result[] = $array[$lastIndex = array_rand(array_diff_key($array, [$lastIndex => null]))]; } echo PHP_EOL . json_encode($result);
Output for git.master_jit
["two","four","one","two","one","three","one","two","one","four"]
Output for git.master
["four","three","two","four","two","one","three","four","two","four"]

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.28 ms | 406 KiB | 5 Q