3v4l.org

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

Function tick_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MabcL
function name:  tick_handler
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'tick_handler%28%29+called%0A'
          1        TICKS                                                    
    6     2      > RETURN                                                   null

End of function tick_handler

Function inverse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MabcL
function name:  inverse
number of ops:  25
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'tick_handler'
          2        DO_FCALL                                      0          
          3        TICKS                                                    
   10     4        ASSIGN                                           ~2      !0, 0
          5        CAST                                          4  ~3      ~2
          6      > JMPZ                                                     ~3, ->18
          7    >   INIT_FCALL                                               'tick_handler'
          8        DO_FCALL                                      0          
          9        TICKS                                                    
   11    10        NEW                                              $5      'Exception'
         11        SEND_VAL_EX                                              'Division+by+zero.'
         12        DO_FCALL                                      0          
         13      > THROW                                         0          $5
         14*       TICKS                                                    
   12    15*       INIT_FCALL                                               'tick_handler'
         16*       DO_FCALL                                      0          
         17*       TICKS                                                    
   14    18    >   DIV                                              ~8      1, !0
         19      > RETURN                                                   ~8
         20*       TICKS                                                    
   15    21*       INIT_FCALL                                               'tick_handler'
         22*       DO_FCALL                                      0          
         23*       TICKS                                                    
   16    24*     > RETURN                                                   null

End of function inverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.31 ms | 1403 KiB | 19 Q