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--; } } $f = new Foo; try { while ($f->step() || true) {} } catch (FooNoMoreException $e) {} var_dump($f);
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 = 62) Position 1 = -2
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
filename:       /in/ksV3V
function name:  (null)
number of ops:  15
compiled vars:  !0 = $f, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   18     3      > JMP                                                      ->4
          4    >   INIT_METHOD_CALL                                         !0, 'step'
          5        DO_FCALL                                      0  $5      
          6      > JMPNZ_EX                                         ~6      $5, ->8
          7    >   BOOL                                             ~6      <true>
          8    > > JMPNZ                                                    ~6, ->4
          9    > > JMP                                                      ->11
   19    10  E > > CATCH                                       last         'FooNoMoreException'
   21    11    >   INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > 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/ksV3V
function name:  step
number of ops:  9
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      > RETURN                                                   null

End of function step

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.3 ms | 1396 KiB | 15 Q