3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'one', 'two', 'three', 'four' ]; $n = 10; $key = -1; $result = []; for ($x = 0; $x < $n; ++$x) { $key = array_rand(array_diff_key($array, [$key => null])); $result[] = $array[$key]; } var_export($result);
Output for git.master
array ( 0 => 'two', 1 => 'one', 2 => 'two', 3 => 'one', 4 => 'four', 5 => 'three', 6 => 'four', 7 => 'three', 8 => 'one', 9 => 'two', )
Output for git.master_jit
array ( 0 => 'four', 1 => 'three', 2 => 'one', 3 => 'three', 4 => 'four', 5 => 'one', 6 => 'three', 7 => 'one', 8 => 'two', 9 => '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:
59.8 ms | 406 KiB | 5 Q