3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooNoMoreException extends Exception {} class Foo { protected $count = 500; public function step() { if (!$this->count) { throw new FooNoMoreException('No more steps to take.'); } $this->count--; $this->addStep(); } public function addStep() { $this->count++; } } // This one $f = new Foo; try { while ($f->step() || true) {} } catch (FooNoMoreException $e) {} var_dump($f); // Or this one $d = new Foo; while (1) { try { $d->step(); } catch (FooNoMoreException $e) { break; } } var_dump($d);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 4
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 18
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 4
Branch analysis from position: 8
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
Found catch point at position: 21
Branch analysis from position: 21
2 jumps found. (Code = 107) Position 1 = 22, Position 2 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
filename:       /in/9Dbu0
function name:  (null)
number of ops:  28
compiled vars:  !0 = $f, !1 = $e, !2 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   24     3      > JMP                                                      ->4
          4    >   INIT_METHOD_CALL                                         !0, 'step'
          5        DO_FCALL                                      0  $6      
          6      > JMPNZ_EX                                         ~7      $6, ->8
          7    >   BOOL                                             ~7      <true>
          8    > > JMPNZ                                                    ~7, ->4
          9    > > JMP                                                      ->11
   25    10  E > > CATCH                                       last         'FooNoMoreException'
   26    11    >   INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   30    14        NEW                                              $9      'Foo'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $9
   31    17      > JMP                                                      ->23
   33    18    >   INIT_METHOD_CALL                                         !2, 'step'
         19        DO_FCALL                                      0          
         20      > JMP                                                      ->23
   35    21  E > > CATCH                                       last         'FooNoMoreException'
   36    22    > > JMP                                                      ->24
   31    23    > > JMPNZ                                                    1, ->18
   39    24    >   INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Class FooNoMoreException: [no user functions]
Class Foo:
Function step:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Dbu0
function name:  step
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'count'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->7
    9     3    >   NEW                                              $2      'FooNoMoreException'
          4        SEND_VAL_EX                                              'No+more+steps+to+take.'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
   11     7    >   PRE_DEC_OBJ                                              'count'
   12     8        INIT_METHOD_CALL                                         'addStep'
          9        DO_FCALL                                      0          
   13    10      > RETURN                                                   null

End of function step

Function addstep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Dbu0
function name:  addStep
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   PRE_INC_OBJ                                              'count'
   17     1      > RETURN                                                   null

End of function addstep

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.53 ms | 1400 KiB | 15 Q