3v4l.org

run code in 300+ PHP versions simultaneously
<?php $begin = 100; $end = 200; $array = [0 => 1, 10 => 2, 50 => 3, 70 => 2, 90 => 3, 110 => 4, 150 => 2, 170 => 3, 180 => 4, 190 => 2]; $array = array_reverse($array, true); $value = 2; $result = []; $prev_time = $end; foreach ($array as $time => $current_value) { if ($current_value == 2) { $result[] = [$time, $prev_time]; } $prev_time = $time; } var_dump($result);
Output for git.master_jit, git.master, rfc.property-hooks
array(4) { [0]=> array(2) { [0]=> int(190) [1]=> int(200) } [1]=> array(2) { [0]=> int(150) [1]=> int(170) } [2]=> array(2) { [0]=> int(70) [1]=> int(90) } [3]=> array(2) { [0]=> int(10) [1]=> int(50) } }

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:
40.49 ms | 402 KiB | 8 Q