3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ColumnFieldsIterator implements \IteratorAggregate { public function getIterator() { return new ArrayIterator(['columns2','columns']); } } class RowFieldsIterator implements \IteratorAggregate { public function getIterator() { return new ArrayIterator(['rows2','rows']); } } class AllIterator implements \IteratorAggregate { public function getIterator() { $iterator = new AppendIterator; $iterator->append(new ColumnFieldsIterator); $iterator->append(new RowFieldsIterator); return $iterator ; } } $all = new AllIterator; foreach ($all as $k => $v) { echo "$k => $v\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/vBAVq
function name:  (null)
number of ops:  17
compiled vars:  !0 = $all, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'columnfieldsiterator'
   11     1        DECLARE_CLASS                                            'rowfieldsiterator'
   19     2        DECLARE_CLASS                                            'alliterator'
   30     3        NEW                                              $3      'AllIterator'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   32     6      > FE_RESET_R                                       $6      !0, ->15
          7    > > FE_FETCH_R                                       ~7      $6, !1, ->15
          8    >   ASSIGN                                                   !2, ~7
   34     9        ROPE_INIT                                     4  ~10     !2
         10        ROPE_ADD                                      1  ~10     ~10, '+%3D%3E+'
         11        ROPE_ADD                                      2  ~10     ~10, !1
         12        ROPE_END                                      3  ~9      ~10, '%0A'
         13        ECHO                                                     ~9
   32    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $6
   35    16      > RETURN                                                   1

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

End of function getiterator

End of class ColumnFieldsIterator.

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

End of function getiterator

End of class RowFieldsIterator.

Class AllIterator:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vBAVq
function name:  getIterator
number of ops:  15
compiled vars:  !0 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'AppendIterator'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_METHOD_CALL                                         !0, 'append'
          4        NEW                                              $4      'ColumnFieldsIterator'
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $4
          7        DO_FCALL                                      0          
   25     8        INIT_METHOD_CALL                                         !0, 'append'
          9        NEW                                              $7      'RowFieldsIterator'
         10        DO_FCALL                                      0          
         11        SEND_VAR_NO_REF_EX                                       $7
         12        DO_FCALL                                      0          
   26    13      > RETURN                                                   !0
   27    14*     > RETURN                                                   null

End of function getiterator

End of class AllIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.2 ms | 1399 KiB | 13 Q