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 (str_val((int)$i) === str_val($i)); } echo check_int1("5");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T0si2
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'check_int1'
          1        SEND_VAL                                                 '5'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > 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/T0si2
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/T0si2
function name:  check_int1
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL_BY_NAME                                       'str_val'
          2        CAST                                          4  ~1      !0
          3        SEND_VAL_EX                                              ~1
          4        DO_FCALL                                      0  $2      
          5        INIT_FCALL_BY_NAME                                       'str_val'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $3      
          8        IS_IDENTICAL                                     ~4      $2, $3
          9      > RETURN                                                   ~4
   13    10*     > RETURN                                                   null

End of function check_int1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.86 ms | 1399 KiB | 16 Q