3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DataContainer implements IteratorAggregate { // create an external Iterator: protected $data; public function __construct(array $data) { $this->data = $data; } public function &getIterator() { /*foreach ($this->data as &$value) { yield $value; }*/ return new ArrayIterator($this); } } $dataContainer = new DataContainer([77, 78, 79]); foreach ($dataContainer as &$value) { echo $value *= -1,"\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 126) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/XJI5W
function name:  (null)
number of ops:  13
compiled vars:  !0 = $dataContainer, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'datacontainer'
   17     1        NEW                                              $2      'DataContainer'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   18     5      > FE_RESET_RW                                      $5      !0, ->11
          6    > > FE_FETCH_RW                                              $5, !1, ->11
   19     7    >   ASSIGN_OP                                     3  ~6      !1, -1
          8        ECHO                                                     ~6
          9        ECHO                                                     '%0A'
   18    10      > JMP                                                      ->6
         11    >   FE_FREE                                                  $5
   20    12      > RETURN                                                   1

Class DataContainer:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XJI5W
function name:  __construct
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'data'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

Function getiterator:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/XJI5W
function name:  getIterator
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $0      'ArrayIterator'
          1        FETCH_THIS                                       $1      
          2        SEND_VAR_EX                                              $1
          3        DO_FCALL                                      0          
          4      > RETURN_BY_REF                                            $0
   14     5*     > RETURN_BY_REF                                            null

End of function getiterator

End of class DataContainer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.75 ms | 1395 KiB | 13 Q