3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements IteratorAggregate { private $data = [ 'foo' => 'bar', 'bar' => 'baz' ]; public function getIterator() { return new ArrayIterator($this->data); } } $Foo = new Foo(); foreach($Foo as $key => $value) { $value = 'in the loop'; } foreach($Foo as $key => &$value) { echo $key, ':', $value, PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 9
2 jumps found. (Code = 125) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/7d1bS
function name:  (null)
number of ops:  20
compiled vars:  !0 = $Foo, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   19     1        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   21     4      > FE_RESET_R                                       $6      !0, ->9
          5    > > FE_FETCH_R                                       ~7      $6, !1, ->9
          6    >   ASSIGN                                                   !2, ~7
   22     7        ASSIGN                                                   !1, 'in+the+loop'
   21     8      > JMP                                                      ->5
          9    >   FE_FREE                                                  $6
   25    10      > FE_RESET_RW                                      $10     !0, ->18
         11    > > FE_FETCH_RW                                      ~11     $10, !1, ->18
         12    >   ASSIGN                                                   !2, ~11
   26    13        ECHO                                                     !2
         14        ECHO                                                     '%3A'
         15        ECHO                                                     !1
         16        ECHO                                                     '%0A'
   25    17      > JMP                                                      ->11
         18    >   FE_FREE                                                  $10
   27    19      > RETURN                                                   1

Class Foo:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7d1bS
function name:  getIterator
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $0      'ArrayIterator'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $1      'data'
          3        SEND_FUNC_ARG                                            $1
          4        DO_FCALL                                      0          
          5      > RETURN                                                   $0
   14     6*     > RETURN                                                   null

End of function getiterator

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.68 ms | 1395 KiB | 13 Q