3v4l.org

run code in 300+ PHP versions simultaneously
<?php $intervals = array(0,5,10,12); $len = count($intervals); $result = -1; $needle = 20; for ($i = 0; $i < $len; $i++) { $current = $intervals[$i]; if ($current > $needle) { $result = $i - 1; break; } } var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
Branch analysis from position: 7
filename:       /in/NaQcc
function name:  (null)
number of ops:  21
compiled vars:  !0 = $intervals, !1 = $len, !2 = $result, !3 = $needle, !4 = $i, !5 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        COUNT                                            ~7      !0
          2        ASSIGN                                                   !1, ~7
    4     3        ASSIGN                                                   !2, -1
    5     4        ASSIGN                                                   !3, 20
    7     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->15
    8     7    >   FETCH_DIM_R                                      ~12     !0, !4
          8        ASSIGN                                                   !5, ~12
   10     9        IS_SMALLER                                               !3, !5
         10      > JMPZ                                                     ~14, ->14
   11    11    >   SUB                                              ~15     !4, 1
         12        ASSIGN                                                   !2, ~15
   12    13      > JMP                                                      ->17
    7    14    >   PRE_INC                                                  !4
         15    >   IS_SMALLER                                               !4, !1
         16      > JMPNZ                                                    ~18, ->7
   16    17    >   INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.57 ms | 1395 KiB | 15 Q