3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(ver('3.1.0', ['1.0.1', '4.4.5', '2.3.7', '3.0.1', '3.0.0'])); /** * 从给定的版本号列表`$vers`中找出比指定版本号`$v`小的最大的版本号并返回 */ function ver($v, $vers) { $res = false; sort($vers); foreach ($vers as $ver) { if ($ver <= $v) { $res = $ver; } else { break; } } return $res; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7IvX4
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL_BY_NAME                                       'ver'
          2        SEND_VAL_EX                                              '3.1.0'
          3        SEND_VAL_EX                                              <array>
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   18     7      > RETURN                                                   1

Function ver:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 14
filename:       /in/7IvX4
function name:  ver
number of ops:  17
compiled vars:  !0 = $v, !1 = $vers, !2 = $res, !3 = $ver
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN                                                   !2, <false>
    9     3        INIT_FCALL                                               'sort'
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   10     6      > FE_RESET_R                                       $6      !1, ->14
          7    > > FE_FETCH_R                                               $6, !3, ->14
   11     8    >   IS_SMALLER_OR_EQUAL                                      !3, !0
          9      > JMPZ                                                     ~7, ->12
   12    10    >   ASSIGN                                                   !2, !3
         11      > JMP                                                      ->13
   14    12    > > JMP                                                      ->14
   10    13    > > JMP                                                      ->7
         14    >   FE_FREE                                                  $6
   17    15      > RETURN                                                   !2
   18    16*     > RETURN                                                   null

End of function ver

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.21 ms | 1396 KiB | 17 Q