3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements \IteratorAggregate { private $a = 'a'; private $b = 'b'; public function getIterator() { return new \ArrayIterator($this); } } $a = new A(); foreach ($a as $key => $value) { var_dump(array($key, $value)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/nZGIb
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   14     1        NEW                                              $3      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   16     4      > FE_RESET_R                                       $6      !0, ->13
          5    > > FE_FETCH_R                                       ~7      $6, !1, ->13
          6    >   ASSIGN                                                   !2, ~7
   17     7        INIT_FCALL                                               'var_dump'
          8        INIT_ARRAY                                       ~9      !2
          9        ADD_ARRAY_ELEMENT                                ~9      !1
         10        SEND_VAL                                                 ~9
         11        DO_ICALL                                                 
   16    12      > JMP                                                      ->5
         13    >   FE_FREE                                                  $6
   18    14      > RETURN                                                   1

Class A:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nZGIb
function name:  getIterator
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $0      'ArrayIterator'
          1        FETCH_THIS                                       $1      
          2        SEND_VAR_EX                                              $1
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $0
   11     5*     > RETURN                                                   null

End of function getiterator

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.55 ms | 1387 KiB | 15 Q