3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 'A'; public function doSomething() { $this->bar = 'B'; yield; } } $foo = new Foo(); echo $foo->bar . PHP_EOL; $it = $foo->doSomething(); echo $foo->bar . PHP_EOL; foreach ($it as $t) { } echo $foo->bar . PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/u59JZ
function name:  (null)
number of ops:  20
compiled vars:  !0 = $foo, !1 = $it, !2 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   15     3        FETCH_OBJ_R                                      ~6      !0, 'bar'
          4        CONCAT                                           ~7      ~6, '%0A'
          5        ECHO                                                     ~7
   16     6        INIT_METHOD_CALL                                         !0, 'doSomething'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !1, $8
   17     9        FETCH_OBJ_R                                      ~10     !0, 'bar'
         10        CONCAT                                           ~11     ~10, '%0A'
         11        ECHO                                                     ~11
   18    12      > FE_RESET_R                                       $12     !1, ->15
         13    > > FE_FETCH_R                                               $12, !2, ->15
         14    > > JMP                                                      ->13
         15    >   FE_FREE                                                  $12
   21    16        FETCH_OBJ_R                                      ~13     !0, 'bar'
         17        CONCAT                                           ~14     ~13, '%0A'
         18        ECHO                                                     ~14
         19      > RETURN                                                   1

Class Foo:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/u59JZ
function name:  doSomething
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   GENERATOR_CREATE                                         
    9     1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  'B'
   10     3        YIELD                                                    
   11     4      > GENERATOR_RETURN                                         

End of function dosomething

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.81 ms | 1395 KiB | 13 Q