3v4l.org

run code in 300+ PHP versions simultaneously
<?php function inverse($x) { if (!$x) { throw new Exception('Division by zero.'); } return 1/$x; } try { echo inverse(0) . "\n"; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } finally { echo "Finally invoked\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 162) Position 1 = 14, Position 2 = 13
Branch analysis from position: 14
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
2 jumps found. (Code = 162) Position 1 = 14, Position 2 = 13
Branch analysis from position: 14
Branch analysis from position: 13
filename:       /in/P1HDo
function name:  (null)
number of ops:  17
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'inverse'
          1        SEND_VAL                                                 0
          2        DO_FCALL                                      0  $2      
          3        CONCAT                                           ~3      $2, '%0A'
          4        ECHO                                                     ~3
          5      > JMP                                                      ->12
   10     6  E > > CATCH                                       last         'Exception'
   11     7    >   ECHO                                                     'Caught+exception%3A+'
          8        INIT_METHOD_CALL                                         !0, 'getMessage'
          9        DO_FCALL                                      0  $4      
         10        ECHO                                                     $4
         11        ECHO                                                     '%0A'
   12    12    > > FAST_CALL                                                ->14
         13    > > JMP                                                      ->16
   13    14    >   ECHO                                                     'Finally+invoked%0A'
         15      > FAST_RET                                                 
   14    16    > > RETURN                                                   1

Function inverse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P1HDo
function name:  inverse
number of ops:  10
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->7
    4     3    >   NEW                                              $2      'Exception'
          4        SEND_VAL_EX                                              'Division+by+zero.'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
    6     7    >   DIV                                              ~4      1, !0
          8      > RETURN                                                   ~4
    7     9*     > RETURN                                                   null

End of function inverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.81 ms | 1399 KiB | 14 Q