3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A implements IteratorAggregate { function __construct( public string $foo = 'bar' ) {} function getIterator(): Traversable { return new ArrayIterator($this); } } $obj = new A; foreach ($obj as $k => &$v) { $v = 42; } var_dump($obj);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 126) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/V7sci
function name:  (null)
number of ops:  14
compiled vars:  !0 = $obj, !1 = $v, !2 = $k
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'a'
   13     1        NEW                                                  $3      'A'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $3
   14     4      > FE_RESET_RW                                          $6      !0, ->9
          5    > > FE_FETCH_RW                                          ~7      $6, !1, ->9
          6    >   ASSIGN                                                       !2, ~7
   15     7        ASSIGN                                                       !1, 42
   14     8      > JMP                                                          ->5
          9    >   FE_FREE                                                      $6
   18    10        INIT_FCALL                                                   'var_dump'
         11        SEND_VAR                                                     !0
         12        DO_ICALL                                                     
         13      > RETURN                                                       1

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

End of function __construct

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

End of function getiterator

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
315.74 ms | 493 KiB | 10 Q