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) { echo $key, $value, PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/R6atE
function name:  (null)
number of ops:  13
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, ->11
          5    > > FE_FETCH_R                                       ~7      $6, !1, ->11
          6    >   ASSIGN                                                   !2, ~7
   22     7        ECHO                                                     !2
          8        ECHO                                                     !1
          9        ECHO                                                     '%0A'
   21    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $6
   23    12      > RETURN                                                   1

Class Foo:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R6atE
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:
146.11 ms | 1385 KiB | 13 Q