3v4l.org

run code in 500+ PHP versions simultaneously
<?php function absint( $maybeint ): int { return abs( (int) $maybeint ); } function another_absint( $maybeint ): int { if ( ! is_float( $maybeint ) && ! is_int( $maybeint ) && ! is_numeric( $maybeint ) && ! is_bool( $maybeint ) ) { return 0; } return abs( (int) $maybeint ); } $data = '999 stuff'; var_dump( $data ); echo "\n"; var_dump( absint( $data ) ); echo "\n"; var_dump( another_absint( $data ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3M0Zf
function name:  (null)
number of ops:  19
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                       !0, '999+stuff'
   17     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                                     
          4        ECHO                                                         '%0A'
   18     5        INIT_FCALL                                                   'var_dump'
          6        INIT_FCALL                                                   'absint'
          7        SEND_VAR                                                     !0
          8        DO_FCALL                                          0  $3      
          9        SEND_VAR                                                     $3
         10        DO_ICALL                                                     
         11        ECHO                                                         '%0A'
   19    12        INIT_FCALL                                                   'var_dump'
         13        INIT_FCALL                                                   'another_absint'
         14        SEND_VAR                                                     !0
         15        DO_FCALL                                          0  $5      
         16        SEND_VAR                                                     $5
         17        DO_ICALL                                                     
         18      > RETURN                                                       1

Function absint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3M0Zf
function name:  absint
number of ops:  9
compiled vars:  !0 = $maybeint
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        INIT_FCALL                                                   'abs'
          2        CAST                                              4  ~1      !0
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5        VERIFY_RETURN_TYPE                                           $2
          6      > RETURN                                                       $2
    5     7*       VERIFY_RETURN_TYPE                                           
          8*     > RETURN                                                       null

End of function absint

Function another_absint:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 11
Branch analysis from position: 7
filename:       /in/3M0Zf
function name:  another_absint
number of ops:  25
compiled vars:  !0 = $maybeint
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    8     1        TYPE_CHECK                                       32  ~1      !0
          2        BOOL_NOT                                             ~2      ~1
          3      > JMPZ_EX                                              ~2      ~2, ->7
          4    >   TYPE_CHECK                                       16  ~3      !0
          5        BOOL_NOT                                             ~4      ~3
          6        BOOL                                                 ~2      ~4
          7    > > JMPZ_EX                                              ~2      ~2, ->11
          8    >   FRAMELESS_ICALL_1                is_numeric          ~5      !0
          9        BOOL_NOT                                             ~6      ~5
         10        BOOL                                                 ~2      ~6
         11    > > JMPZ_EX                                              ~2      ~2, ->15
         12    >   TYPE_CHECK                                       12  ~7      !0
         13        BOOL_NOT                                             ~8      ~7
         14        BOOL                                                 ~2      ~8
         15    > > JMPZ                                                         ~2, ->17
    9    16    > > RETURN                                                       0
   12    17    >   INIT_FCALL                                                   'abs'
         18        CAST                                              4  ~9      !0
         19        SEND_VAL                                                     ~9
         20        DO_ICALL                                             $10     
         21        VERIFY_RETURN_TYPE                                           $10
         22      > RETURN                                                       $10
   13    23*       VERIFY_RETURN_TYPE                                           
         24*     > RETURN                                                       null

End of function another_absint

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.67 ms | 1419 KiB | 17 Q