3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $names = ['Adamino', 'Pete', 'Mark', 'Gonz']; $pairs = []; $iteration = 0; while (count($names) > 0) { ++$iteration; if ($iteration > 10) break; $plucked = array_rand($names, 2); $pair = [$names[$plucked[0]], $names[$plucked[1]]]; unset($names[$plucked[0]], $names[$plucked[1]]); $pairs[] = $pair; } $result = "The PP randomizer has selected: \n"; foreach ($pairs as $p) { $result .= " -> {$p[0]} and {$p[1]}\n"; }
based on HtGCm
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6