3v4l.org

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

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

End of function inverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.9 ms | 1399 KiB | 15 Q