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 (!$x) {tick_handler(); throw new Exception('Division by zero.');tick_handler(); } return 1/$x;tick_handler(); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/951og
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   TICKS                                                    
   18     1      > RETURN                                                   1

Function tick_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/951og
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 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/951og
function name:  inverse
number of ops:  24
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        BOOL_NOT                                         ~2      !0
          5      > JMPZ                                                     ~2, ->17
          6    >   INIT_FCALL                                               'tick_handler'
          7        DO_FCALL                                      0          
          8        TICKS                                                    
   11     9        NEW                                              $4      'Exception'
         10        SEND_VAL_EX                                              'Division+by+zero.'
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $4
         13*       TICKS                                                    
         14*       INIT_FCALL                                               'tick_handler'
         15*       DO_FCALL                                      0          
         16*       TICKS                                                    
   13    17    >   DIV                                              ~7      1, !0
         18      > RETURN                                                   ~7
         19*       TICKS                                                    
         20*       INIT_FCALL                                               'tick_handler'
         21*       DO_FCALL                                      0          
         22*       TICKS                                                    
   14    23*     > RETURN                                                   null

End of function inverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.63 ms | 1390 KiB | 17 Q