3v4l.org

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

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

End of function getiterator

End of class A.

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

End of function getiterator

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.4 ms | 1395 KiB | 13 Q