3v4l.org

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

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

End of function inverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.56 ms | 1403 KiB | 18 Q