3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A1 { protected function a() { $i = 0; $s = ''; while (true) { $i++; if ($i > 10000) { break; } foreach ([['a' => 1], 2, ['a' => 2]] as $p) { if ($p == 2) { continue; } if ($i % 1000 == 999) { throw new \Exception('t'); } yield $p['a'] => 123; } } } public function b() { $sum = 0; try { foreach ($this->a() as $k => $v) { $sum += $k + $v; } echo 'Done: ', $sum; } catch (\Exception $e) { echo $e; } } } (new A1)->b();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hSHVf
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   NEW                                              $0      'A1'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'b'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class A1:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 23
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 23
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
Branch analysis from position: 4
Branch analysis from position: 23
filename:       /in/hSHVf
function name:  a
number of ops:  26
compiled vars:  !0 = $i, !1 = $s, !2 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   GENERATOR_CREATE                                         
    8     1        ASSIGN                                                   !0, 0
    9     2        ASSIGN                                                   !1, ''
   10     3      > JMP                                                      ->24
   11     4    >   PRE_INC                                                  !0
   12     5        IS_SMALLER                                               10000, !0
          6      > JMPZ                                                     ~6, ->8
   13     7    > > JMP                                                      ->25
   15     8    > > FE_RESET_R                                       $7      <array>, ->23
          9    > > FE_FETCH_R                                               $7, !2, ->23
   16    10    >   IS_EQUAL                                                 !2, 2
         11      > JMPZ                                                     ~8, ->13
   17    12    > > JMP                                                      ->9
   19    13    >   MOD                                              ~9      !0, 1000
         14        IS_EQUAL                                                 ~9, 999
         15      > JMPZ                                                     ~10, ->20
   20    16    >   NEW                                              $11     'Exception'
         17        SEND_VAL_EX                                              't'
         18        DO_FCALL                                      0          
         19      > THROW                                         0          $11
   24    20    >   FETCH_DIM_R                                      ~13     !2, 'a'
         21        YIELD                                                    123, ~13
   15    22      > JMP                                                      ->9
         23    >   FE_FREE                                                  $7
   10    24    > > JMPNZ                                                    <true>, ->4
   27    25    > > GENERATOR_RETURN                                         

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
Found catch point at position: 13
Branch analysis from position: 13
2 jumps found. (Code = 107) Position 1 = 14, Position 2 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hSHVf
function name:  b
number of ops:  16
compiled vars:  !0 = $sum, !1 = $v, !2 = $k, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ASSIGN                                                   !0, 0
   33     1        INIT_METHOD_CALL                                         'a'
          2        DO_FCALL                                      0  $5      
          3      > FE_RESET_R                                       $6      $5, ->9
          4    > > FE_FETCH_R                                       ~7      $6, !1, ->9
          5    >   ASSIGN                                                   !2, ~7
   34     6        ADD                                              ~9      !2, !1
          7        ASSIGN_OP                                     1          !0, ~9
   33     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $6
   36    10        ECHO                                                     'Done%3A+'
         11        ECHO                                                     !0
         12      > JMP                                                      ->15
   37    13  E > > CATCH                                       last         'Exception'
   38    14    >   ECHO                                                     !3
   40    15    > > RETURN                                                   null

End of function b

End of class A1.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.78 ms | 1390 KiB | 13 Q