3v4l.org

run code in 500+ PHP versions simultaneously
<?php function parseIntOrException($val) { $int = (int)$val; if ((string)$int !== (string)$val) { return FALSE; } return $int; } $result = array(); foreach (array(1, '2', '3.0', 4.0, 5) as $x) { $result[var_export($x, TRUE)] = var_export(parseIntOrException($x), TRUE); } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 17
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/Tf8nh
function name:  (null)
number of ops:  22
compiled vars:  !0 = $result, !1 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                       !0, <array>
   12     1      > FE_RESET_R                                           $3      <array>, ->17
          2    > > FE_FETCH_R                                                   $3, !1, ->17
   13     3    >   INIT_FCALL                                                   'var_export'
          4        SEND_VAR                                                     !1
          5        SEND_VAL                                                     <true>
          6        DO_ICALL                                             $4      
          7        INIT_FCALL                                                   'var_export'
          8        INIT_FCALL                                                   'parseintorexception'
          9        SEND_VAR                                                     !1
         10        DO_FCALL                                          0  $6      
         11        SEND_VAR                                                     $6
         12        SEND_VAL                                                     <true>
         13        DO_ICALL                                             $7      
         14        ASSIGN_DIM                                                   !0, $4
         15        OP_DATA                                                      $7
   12    16      > JMP                                                          ->2
         17    >   FE_FREE                                                      $3
   15    18        INIT_FCALL                                                   'print_r'
         19        SEND_VAR                                                     !0
         20        DO_ICALL                                                     
         21      > RETURN                                                       1

Function parseintorexception:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Tf8nh
function name:  parseIntOrException
number of ops:  10
compiled vars:  !0 = $val, !1 = $int
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        CAST                                              4  ~2      !0
          2        ASSIGN                                                       !1, ~2
    5     3        CAST                                              6  ~4      !1
          4        CAST                                              6  ~5      !0
          5        IS_NOT_IDENTICAL                                             ~4, ~5
          6      > JMPZ                                                         ~6, ->8
    6     7    > > RETURN                                                       <false>
    8     8    > > RETURN                                                       !1
    9     9*     > RETURN                                                       null

End of function parseintorexception

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.24 ms | 2950 KiB | 16 Q