3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check_int($i) { if (preg_match('[^0-9]', $i)) { return 0; } else { return 1; } } function check_int1($i) { return (strval((int)$i) === strval($i)); } echo check_int1(-10) ? "It's an int\n" : "It's not an int\n"; echo check_int("-10") ? "It's an int\n" : "It's not an int\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
Branch analysis from position: 14
filename:       /in/mu48l
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'check_int1'
          1        SEND_VAL                                                 -10
          2        DO_FCALL                                      0  $0      
          3      > JMPZ                                                     $0, ->6
          4    >   QM_ASSIGN                                        ~1      'It%27s+an+int%0A'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~1      'It%27s+not+an+int%0A'
          7    >   ECHO                                                     ~1
   17     8        INIT_FCALL                                               'check_int'
          9        SEND_VAL                                                 '-10'
         10        DO_FCALL                                      0  $2      
         11      > JMPZ                                                     $2, ->14
         12    >   QM_ASSIGN                                        ~3      'It%27s+an+int%0A'
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~3      'It%27s+not+an+int%0A'
         15    >   ECHO                                                     ~3
         16      > RETURN                                                   1

Function check_int:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mu48l
function name:  check_int
number of ops:  10
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%5B%5E0-9%5D'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > JMPZ                                                     $1, ->8
    4     6    > > RETURN                                                   0
          7*       JMP                                                      ->9
    6     8    > > RETURN                                                   1
    8     9*     > RETURN                                                   null

End of function check_int

Function check_int1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mu48l
function name:  check_int1
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        CAST                                          4  ~1      !0
          2        CAST                                          6  ~2      ~1
          3        CAST                                          6  ~3      !0
          4        IS_IDENTICAL                                     ~4      ~2, ~3
          5      > RETURN                                                   ~4
   13     6*     > RETURN                                                   null

End of function check_int1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.49 ms | 1403 KiB | 17 Q