3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Entity { protected $_properties = []; public function &__get($property) { $value = null; return $value; } public function __set($property, $value) { $property = [$property => $value]; foreach ($property as $p => $value) { $this->_properties[$p] = $value; } } } class CustomIterator extends IteratorIterator { public $callback; public function __construct($items) { $this->callback = function ($a) { $a->foo .= ' world'; return $a; }; parent::__construct($items); } public function current() { $c = $this->callback; return $c(parent::current()); } } $entity = new Entity(); $it = new CustomIterator(new ArrayIterator([$entity])); $it->rewind(); var_dump($it->current());
based on S3fTZ
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pb3a2
function name:  (null)
number of ops:  19
compiled vars:  !0 = $entity, !1 = $it
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  43     0  E >   NEW                                              $2      :33
         1        DO_FCALL                                      0          
         2        QM_ASSIGN                                                !0
  45     3        NEW                                              $5      :29
         4        NEW                                              $6      :29
         5        INIT_ARRAY                                       ~7      !0
         6        SEND_VAL_EX                                              ~7
         7        DO_FCALL                                      0          
         8        SEND_VAR_NO_REF_EX                                       $6
         9        DO_FCALL                                      0          
        10        QM_ASSIGN                                                !1
  46    11        INIT_METHOD_CALL                                         !1, 'rewind'
        12        DO_FCALL                                      0          
  47    13        INIT_FCALL                                               'var_dump'
        14        INIT_METHOD_CALL                                         !1, 'current'
        15        DO_FCALL                                      0  $12     
        16        SEND_VAR                                                 $12
        17        DO_ICALL                                                 
        18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fpb3a20x7f1dca87a21a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pb3a2
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  30     0  E >   RECV                                             !0      
  31     1        ASSIGN_SL                                     8          !0, 'foo'
         2        OP_DATA                                                  '+world'
  32     3      > RETURN                                                   !0
  33     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fpb3a20x7f1dca87a21a

Class Entity:
Function __get:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/pb3a2
function name:  __get
number of ops:  4
compiled vars:  !0 = $property, !1 = $value
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   9     0  E >   RECV                                             !0      
  11     1        QM_ASSIGN                                                !1
  12     2      > RETURN_BY_REF                                            !1
  13     3*     > RETURN_BY_REF                                            null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/pb3a2
function name:  __set
number of ops:  13
compiled vars:  !0 = $property, !1 = $value, !2 = $p
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   RECV                                             !0      
         1        RECV                                             !1      
  17     2        INIT_ARRAY                                       ~3      !1, !0
         3        QM_ASSIGN                                                !0
  19     4      > FE_RESET_R                                       $5      !0, ->11
         5    > > FE_FETCH_R                                       ~6      $5, !1, ->11
         6    >   QM_ASSIGN                                                !2
  20     7        FETCH_OBJ_W                                      $8      '_properties'
         8        ASSIGN_ADD                                    0          $8, !2
         9        OP_DATA                                                  !1
  19    10      > JMP                                                      ->5
        11    >   FE_FREE                                                  $5
  22    12      > RETURN                                                   null

End of function __set

End of class Entity.

Class CustomIterator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pb3a2
function name:  __construct
number of ops:  8
compiled vars:  !0 = $items
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  29     0  E >   RECV                                             !0      
  30     1        RAISE_ABSTRACT_ERROR                             ~2      '%00%7Bclosure%7D%2Fin%2Fpb3a20x7f1dca87a21a'
         2        ASSIGN_SUB                                    0          'callback'
  33     3        OP_DATA                                                  ~2
  34     4        INIT_STATIC_METHOD_CALL                                  
         5        SEND_VAR_EX                                              !0
         6        DO_FCALL                                      0          
  35     7      > RETURN                                                   null

End of function __construct

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pb3a2
function name:  current
number of ops:  9
compiled vars:  !0 = $c
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  38     0  E >   FETCH_OBJ_R                                      ~1      'callback'
         1        QM_ASSIGN                                                !0
  39     2        INIT_DYNAMIC_CALL                                        !0
         3        INIT_STATIC_METHOD_CALL                                  'current'
         4        DO_FCALL                                      0  $3      
         5        SEND_VAR_NO_REF_EX                                       $3
         6        DO_FCALL                                      0  $4      
         7      > RETURN                                                   $4
  40     8*     > RETURN                                                   null

End of function current

End of class CustomIterator.

Generated using Vulcan Logic Dumper, using php 7.4.0