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]}"; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 3
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 3
Branch analysis from position: 29
Branch analysis from position: 3
Branch analysis from position: 26
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
Branch analysis from position: 16
filename:       /in/oONnG
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array, !1 = $test, !2 = $foundKey, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, -1
          2      > JMP                                                      ->27
    6     3    >   ROPE_INIT                                     3  ~8      '%0Atest+search+for+'
          4        ROPE_ADD                                      1  ~8      ~8, !1
          5        ROPE_END                                      2  ~7      ~8, '%3A+'
          6        ECHO                                                     ~7
    8     7        ASSIGN                                                   !2, 'not+found'
    9     8      > FE_RESET_R                                       $11     !0, ->16
          9    > > FE_FETCH_R                                       ~12     $11, !3, ->16
         10    >   ASSIGN                                                   !4, ~12
   10    11        IS_SMALLER                                               !1, !3
         12      > JMPZ                                                     ~14, ->14
   11    13    > > JMP                                                      ->16
   13    14    >   ASSIGN                                                   !2, !4
    9    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $11
   15    17        NOP                                                      
         18        FAST_CONCAT                                      ~16     'index+%3D+', !2
         19        ECHO                                                     ~16
   16    20        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
         21      > JMPZ                                                     ~17, ->26
   17    22    >   NOP                                                      
         23        FETCH_DIM_R                                      ~18     !0, !2
         24        FAST_CONCAT                                      ~19     '%2C+value+%3D+', ~18
         25        ECHO                                                     ~19
    5    26    >   PRE_INC                                                  !1
         27    >   IS_SMALLER                                               !1, 9
         28      > JMPNZ                                                    ~21, ->3
   19    29    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.29 ms | 1003 KiB | 13 Q