3v4l.org

run code in 300+ PHP versions simultaneously
<?php $search = '35'; $range = ''; $arr = [ '0' => '0;0', '1' => '20;0-20', '2' => '50;20-50', '3' => '100;50-100', '4' => '200;100-200', '5' => '500;200-500' ]; foreach ( $arr as $k => $v ) { $values = explode(";", $v); if ( $values[0] >= $search ) break; } echo "Current: [".$k."] ".$values[1]; if($k>0||$less=0)$less = $k-1; $less_values = explode(";", $arr[$less]); echo "\nLess: [".$less."] ".$less_values[1];
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 26
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
Branch analysis from position: 16
filename:       /in/QmQq1
function name:  (null)
number of ops:  41
compiled vars:  !0 = $search, !1 = $range, !2 = $arr, !3 = $v, !4 = $k, !5 = $values, !6 = $less, !7 = $less_values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '35'
    3     1        ASSIGN                                                   !1, ''
    5     2        ASSIGN                                                   !2, <array>
   14     3      > FE_RESET_R                                       $11     !2, ->16
          4    > > FE_FETCH_R                                       ~12     $11, !3, ->16
          5    >   ASSIGN                                                   !4, ~12
   15     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%3B'
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $14     
         10        ASSIGN                                                   !5, $14
   16    11        FETCH_DIM_R                                      ~16     !5, 0
         12        IS_SMALLER_OR_EQUAL                                      !0, ~16
         13      > JMPZ                                                     ~17, ->15
         14    > > JMP                                                      ->16
   14    15    > > JMP                                                      ->4
         16    >   FE_FREE                                                  $11
   17    17        CONCAT                                           ~18     'Current%3A+%5B', !4
         18        CONCAT                                           ~19     ~18, '%5D+'
         19        FETCH_DIM_R                                      ~20     !5, 1
         20        CONCAT                                           ~21     ~19, ~20
         21        ECHO                                                     ~21
   18    22        IS_SMALLER                                       ~22     0, !4
         23      > JMPNZ_EX                                         ~22     ~22, ->26
         24    >   ASSIGN                                           ~23     !6, 0
         25        BOOL                                             ~22     ~23
         26    > > JMPZ                                                     ~22, ->29
         27    >   SUB                                              ~24     !4, 1
         28        ASSIGN                                                   !6, ~24
   19    29    >   INIT_FCALL                                               'explode'
         30        SEND_VAL                                                 '%3B'
         31        FETCH_DIM_R                                      ~26     !2, !6
         32        SEND_VAL                                                 ~26
         33        DO_ICALL                                         $27     
         34        ASSIGN                                                   !7, $27
   20    35        CONCAT                                           ~29     '%0ALess%3A+%5B', !6
         36        CONCAT                                           ~30     ~29, '%5D+'
         37        FETCH_DIM_R                                      ~31     !7, 1
         38        CONCAT                                           ~32     ~30, ~31
         39        ECHO                                                     ~32
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.73 ms | 1400 KiB | 15 Q