3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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,0,'0') as $x) { $result[var_export($x, TRUE)] = var_export(parseIntOrException($x), TRUE); } print_r($result);
based on Tf8nh
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
Jump found. Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
Jump found. Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
Jump found. Position 1 = -2
Branch analysis from position: 18
filename:       /in/F7o53
function name:  (null)
number of ops:  23
compiled vars:  !0 = $result, !1 = $x
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  11     1        ASSIGN                                                   !0, <array>
  12     2      > FE_RESET_R                                       $3      <array>, ->18
         3    > > FE_FETCH_R                                               $3, !1, ->18
  13     4    >   INIT_FCALL                                               'var_export'
         5        SEND_VAR                                                 !1
         6        SEND_VAL                                                 <true>
         7        DO_ICALL                                         $4      
         8        INIT_FCALL                                               'var_export'
         9        INIT_FCALL                                               'parseintorexception'
        10        SEND_VAR                                                 !1
        11        DO_FCALL                                      0  $6      
        12        SEND_VAR                                                 $6
        13        SEND_VAL                                                 <true>
        14        DO_ICALL                                         $7      
        15        ASSIGN_DIM                                               !0, $4
        16        OP_DATA                                                  $7
        17      > JMP                                                      ->3
        18    >   FE_FREE                                                  $3
  15    19        INIT_FCALL                                               'print_r'
        20        SEND_VAR                                                 !0
        21        DO_ICALL                                                 
        22      > RETURN                                                   1

Function parseintorexception:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
Jump found. Position 1 = -2
Branch analysis from position: 8
Jump found. Position 1 = -2
filename:       /in/F7o53
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                                 ~6      ~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 7.3.0