3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check_num_range(int $num) { if ($num < 0 || $num > 100) trigger_error('Invalid range'); } // Somewhere far from function definition. $num = "hundrets of dogs"; // Somewhere far from $num definition. check_num_range($num); // Trying to check validity, int and range. echo 'You have '.$num. ' now <br />'; // But $num could have any string. // "check_num_range((int)$num)" wouldn't help also.
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UStfP
function name:  (null)
number of ops:  8
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 'hundrets+of+dogs'
    7     1        INIT_FCALL                                               'check_num_range'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
    8     4        CONCAT                                           ~3      'You+have+', !0
          5        CONCAT                                           ~4      ~3, '+now+%3Cbr+%2F%3E'
          6        ECHO                                                     ~4
    9     7      > RETURN                                                   1

Function check_num_range:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
Branch analysis from position: 5
filename:       /in/UStfP
function name:  check_num_range
number of ops:  10
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        IS_SMALLER                                       ~1      !0, 0
          2      > JMPNZ_EX                                         ~1      ~1, ->5
          3    >   IS_SMALLER                                       ~2      100, !0
          4        BOOL                                             ~1      ~2
          5    > > JMPZ                                                     ~1, ->9
    3     6    >   INIT_FCALL                                               'trigger_error'
          7        SEND_VAL                                                 'Invalid+range'
          8        DO_ICALL                                                 
          9    > > RETURN                                                   null

End of function check_num_range

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.03 ms | 1004 KiB | 15 Q