3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [0, 0, 4, 4, 5, 7]; for ($test = -1; $test < 9; ++$test) { echo "\ntest search for $test: "; $foundKey = 'not found'; foreach ($array as $key => $value) { if ($value > $test) { break; } $foundKey = $key; } echo "index = $foundKey"; if (isset($array[$foundKey])) { echo ", value = {$array[$foundKey]}"; } }
Output for git.master, git.master_jit, rfc.property-hooks
test search for -1: index = not found test search for 0: index = 1, value = 0 test search for 1: index = 1, value = 0 test search for 2: index = 1, value = 0 test search for 3: index = 1, value = 0 test search for 4: index = 3, value = 4 test search for 5: index = 4, value = 5 test search for 6: index = 4, value = 5 test search for 7: index = 5, value = 7 test search for 8: index = 5, value = 7

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