3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = [1.2549999999, 1.28012, 2.01212, 4.012, 5.0000012, 5.012121001, -0.12]; $boundaries = [1.26, 2.46, 5.01]; function checkRange(float $number, array $boundaries): int { if ($number < 0) { return -1; } foreach ($boundaries as $i => $boundary) { if ($number < $boundary) { return $i + 1; break; } } return 4; } foreach ($numbers as $number) { echo "$number at Range ", checkRange($number, $boundaries), "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Qksa4
function name:  (null)
number of ops:  16
compiled vars:  !0 = $numbers, !1 = $boundaries, !2 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   21     2      > FE_RESET_R                                       $5      !0, ->14
          3    > > FE_FETCH_R                                               $5, !2, ->14
   22     4    >   NOP                                                      
          5        FAST_CONCAT                                      ~6      !2, '+at+Range+'
          6        ECHO                                                     ~6
          7        INIT_FCALL                                               'checkrange'
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0  $7      
         11        ECHO                                                     $7
         12        ECHO                                                     '%0A'
   21    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $5
   23    15      > RETURN                                                   1

Function checkrange:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/Qksa4
function name:  checkRange
number of ops:  20
compiled vars:  !0 = $number, !1 = $boundaries, !2 = $boundary, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        IS_SMALLER                                               !0, 0
          3      > JMPZ                                                     ~4, ->5
    9     4    > > RETURN                                                   -1
   12     5    > > FE_RESET_R                                       $5      !1, ->16
          6    > > FE_FETCH_R                                       ~6      $5, !2, ->16
          7    >   ASSIGN                                                   !3, ~6
   13     8        IS_SMALLER                                               !0, !2
          9      > JMPZ                                                     ~8, ->15
   14    10    >   ADD                                              ~9      !3, 1
         11        VERIFY_RETURN_TYPE                                       ~9
         12        FE_FREE                                                  $5
         13      > RETURN                                                   ~9
   15    14*       JMP                                                      ->16
   12    15    > > JMP                                                      ->6
         16    >   FE_FREE                                                  $5
   18    17      > RETURN                                                   4
   19    18*       VERIFY_RETURN_TYPE                                       
         19*     > RETURN                                                   null

End of function checkrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.04 ms | 1403 KiB | 14 Q