3v4l.org

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

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:
64.76 ms | 406 KiB | 5 Q