3v4l.org

run code in 300+ PHP versions simultaneously
<?php function solution($set) { $diff = array_diff(range(1, max($set)), $set); sort($diff); return !isset($diff[0]) ? max($set) + 1 : ($diff[0] < 1 ? 1 : $diff[0]); } echo solution([39, 68, 47, 2, 19, 64]).PHP_EOL; echo solution([1, 3, 6, 4, 1, 2]).PHP_EOL; echo solution([1, 2, 3]).PHP_EOL; echo solution([-1, -3]).PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
1 5 4 1

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:
50.4 ms | 1388 KiB | 4 Q