3v4l.org

run code in 300+ PHP versions simultaneously
<?php $players = range(1, 32); $count = count($players); // Order players. for ($i = 0; $i < log($count / 2, 2); $i++) { $out = array(); foreach ($players as $player) { $splice = pow(2, $i); $out = array_merge($out, array_splice($players, 0, $splice)); $out = array_merge($out, array_splice($players, -$splice)); } $players = $out; } // Print match list. for ($i = 0; $i < $count; $i++) { printf('%s vs %s<br />%s', $players[$i], $players[++$i], PHP_EOL); } ?>
Output for 4.3.10 - 4.3.11, 4.4.0 - 4.4.9, 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
1 vs 32<br /> 16 vs 17<br /> 8 vs 25<br /> 9 vs 24<br /> 4 vs 29<br /> 13 vs 20<br /> 5 vs 28<br /> 12 vs 21<br /> 2 vs 31<br /> 15 vs 18<br /> 7 vs 26<br /> 10 vs 23<br /> 3 vs 30<br /> 14 vs 19<br /> 6 vs 27<br /> 11 vs 22<br />
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 1 vs 32<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 16 vs 17<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 8 vs 25<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 9 vs 24<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 4 vs 29<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 13 vs 20<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 5 vs 28<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 12 vs 21<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 2 vs 31<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 15 vs 18<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 7 vs 26<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 10 vs 23<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 3 vs 30<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 14 vs 19<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 6 vs 27<br />PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NOhsp on line 22 11 vs 22<br />PHP_EOL

preferences:
251.33 ms | 405 KiB | 457 Q