3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Dummy { public $input; public $logged = false; function __construct($input = array(1,2,3)) { $this->input = $input; } function run($logged) { foreach($this->input as $key=>$value) { if($key == 2 && $logged == false) throw new Exception('hello exception'); } } } function retry(Dummy $dum, $logged = false) { try { $dum->run($logged); } catch(Exception $e) { // solve the exception if(!$logged) $logged = true; retry($dum, $logged); } } $dum = new Dummy; retry($dum, false);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Mkat
function name:  (null)
number of ops:  8
compiled vars:  !0 = $dum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   NEW                                              $1      'Dummy'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   38     3        INIT_FCALL                                               'retry'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <false>
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function retry:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/8Mkat
function name:  retry
number of ops:  15
compiled vars:  !0 = $dum, !1 = $logged, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
   25     2        INIT_METHOD_CALL                                         !0, 'run'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
          5      > JMP                                                      ->14
   26     6  E > > CATCH                                       last         'Exception'
   29     7    >   BOOL_NOT                                         ~4      !1
          8      > JMPZ                                                     ~4, ->10
   30     9    >   ASSIGN                                                   !1, <true>
   32    10    >   INIT_FCALL_BY_NAME                                       'retry'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   34    14    > > RETURN                                                   null

End of function retry

Class Dummy:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Mkat
function name:  __construct
number of ops:  4
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      <array>
    8     1        ASSIGN_OBJ                                               'input'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

Function run:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/8Mkat
function name:  run
number of ops:  17
compiled vars:  !0 = $logged, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        FETCH_OBJ_R                                      ~3      'input'
          2      > FE_RESET_R                                       $4      ~3, ->15
          3    > > FE_FETCH_R                                       ~5      $4, !1, ->15
          4    >   ASSIGN                                                   !2, ~5
   15     5        IS_EQUAL                                         ~7      !2, 2
          6      > JMPZ_EX                                          ~7      ~7, ->9
          7    >   BOOL_NOT                                         ~8      !0
          8        BOOL                                             ~7      ~8
          9    > > JMPZ                                                     ~7, ->14
         10    >   NEW                                              $9      'Exception'
         11        SEND_VAL_EX                                              'hello+exception'
         12        DO_FCALL                                      0          
         13      > THROW                                         0          $9
   13    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $4
   17    16      > RETURN                                                   null

End of function run

End of class Dummy.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.41 ms | 1394 KiB | 14 Q