3v4l.org

run code in 300+ PHP versions simultaneously
<?php function castNumber($n) { if(!is_numeric($n)) return 0; return (is_float($n)) ? (float) $n : (int) $n; } var_dump($casted = castNumber('8.9'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXJaS
function name:  (null)
number of ops:  8
compiled vars:  !0 = $casted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'castnumber'
          2        SEND_VAL                                                 '8.9'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                           ~2      !0, $1
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function castnumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXJaS
function name:  castNumber
number of ops:  16
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'is_numeric'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPZ                                                     ~2, ->7
          6    > > RETURN                                                   0
    6     7    >   TYPE_CHECK                                   32          !0
          8      > JMPZ                                                     ~3, ->12
          9    >   CAST                                          5  ~4      !0
         10        QM_ASSIGN                                        ~5      ~4
         11      > JMP                                                      ->14
         12    >   CAST                                          4  ~6      !0
         13        QM_ASSIGN                                        ~5      ~6
         14    > > RETURN                                                   ~5
    7    15*     > RETURN                                                   null

End of function castnumber

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.63 ms | 1399 KiB | 18 Q