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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 20
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/J0nBn
function name:  (null)
number of ops:  27
compiled vars:  !0 = $begin, !1 = $end, !2 = $array, !3 = $value, !4 = $result, !5 = $prev_time, !6 = $current_value, !7 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100
          1        ASSIGN                                                   !1, 200
    4     2        ASSIGN                                                   !2, <array>
    5     3        INIT_FCALL                                               'array_reverse'
          4        SEND_VAR                                                 !2
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !2, $11
    6     8        ASSIGN                                                   !3, 2
    7     9        ASSIGN                                                   !4, <array>
    8    10        ASSIGN                                                   !5, !1
    9    11      > FE_RESET_R                                       $16     !2, ->22
         12    > > FE_FETCH_R                                       ~17     $16, !6, ->22
         13    >   ASSIGN                                                   !7, ~17
   11    14        IS_EQUAL                                                 !6, 2
         15      > JMPZ                                                     ~19, ->20
   13    16    >   INIT_ARRAY                                       ~21     !7
         17        ADD_ARRAY_ELEMENT                                ~21     !5
         18        ASSIGN_DIM                                               !4
         19        OP_DATA                                                  ~21
   15    20    >   ASSIGN                                                   !5, !7
    9    21      > JMP                                                      ->12
         22    >   FE_FREE                                                  $16
   17    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.33 ms | 1396 KiB | 17 Q