3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeException extends Exception {} function foo() { echo 'attempting 1' . PHP_EOL; } function bar($someCondition) { echo 'attempting 2 with ' . $someCondition . PHP_EOL; if ($someCondition == null) { throw new SomeException('Foo foo fooey'); } } function baz() { echo 'attempting 3' . PHP_EOL; throw new Exception('Boo boo bar'); } function fixupforbar(&$someCondition) { $someCondition = 5; } /** main() **/ $someCondition = null; try { foo(); BAR: bar($someCondition); baz(); } catch (SomeException $e) { fixupforbar($someCondition); goto BAR; } catch (Exception $e) { echo 'Exception caught: ' . $e->getMessage() . PHP_EOL; } finally { echo 'Cleaning up' . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 162) Position 1 = 24, Position 2 = 23
Branch analysis from position: 24
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 23
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: 9
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
2 jumps found. (Code = 107) Position 1 = 17, Position 2 = -2
Branch analysis from position: 17
2 jumps found. (Code = 162) Position 1 = 24, Position 2 = 23
Branch analysis from position: 24
Branch analysis from position: 23
Found catch point at position: 16
Branch analysis from position: 16
filename:       /in/K3QgW
function name:  (null)
number of ops:  27
compiled vars:  !0 = $someCondition, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   ASSIGN                                                   !0, null
   33     1        INIT_FCALL                                               'foo'
          2        DO_FCALL                                      0          
   34     3    >   INIT_FCALL                                               'bar'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0          
   35     6        INIT_FCALL                                               'baz'
          7        DO_FCALL                                      0          
          8      > JMP                                                      ->22
   36     9  E > > CATCH                                                    'SomeException', ->16
   37    10    >   INIT_FCALL                                               'fixupforbar'
         11        SEND_REF                                                 !0
         12        DO_FCALL                                      0          
   38    13        NOP                                                      
         14      > JMP                                                      ->3
         15*       JMP                                                      ->22
   39    16  E > > CATCH                                       last         'Exception'
   40    17    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         18        DO_FCALL                                      0  $8      
         19        CONCAT                                           ~9      'Exception+caught%3A+', $8
         20        CONCAT                                           ~10     ~9, '%0A'
         21        ECHO                                                     ~10
   41    22    > > FAST_CALL                                                ->24
         23    > > JMP                                                      ->26
   42    24    >   ECHO                                                     'Cleaning+up%0A'
         25      > FAST_RET                                                 
   43    26    > > RETURN                                                   1

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

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K3QgW
function name:  bar
number of ops:  11
compiled vars:  !0 = $someCondition
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        CONCAT                                           ~1      'attempting+2+with+', !0
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
   11     4        IS_EQUAL                                                 !0, null
          5      > JMPZ                                                     ~3, ->10
   12     6    >   NEW                                              $4      'SomeException'
          7        SEND_VAL_EX                                              'Foo+foo+fooey'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $4
   14    10    > > RETURN                                                   null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/K3QgW
function name:  baz
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                     'attempting+3%0A'
   18     1        NEW                                              $0      'Exception'
          2        SEND_VAL_EX                                              'Boo+boo+bar'
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $0
   19     5*     > RETURN                                                   null

End of function baz

Function fixupforbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K3QgW
function name:  fixupforbar
number of ops:  3
compiled vars:  !0 = $someCondition
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ASSIGN                                                   !0, 5
   23     2      > RETURN                                                   null

End of function fixupforbar

Class SomeException: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.07 ms | 1403 KiB | 17 Q