3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ObjectKeyIterator extends IteratorIterator { public function __construct(\Traversable $iterator) { parent::__construct($iterator); } public function key() { $key = parent::key(); return (object)array('key' => $key); } } foreach(new ObjectKeyIterator(new ArrayObject(array('test' => 'foo', 2,4, 'bo' => 24,2))) as $key => $value) { var_dump($key, $value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/G0fZj
function name:  (null)
number of ops:  16
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $2      'ObjectKeyIterator'
          1        NEW                                              $3      'ArrayObject'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $3
          5        DO_FCALL                                      0          
          6      > FE_RESET_R                                       $6      $2, ->14
          7    > > FE_FETCH_R                                       ~7      $6, !0, ->14
          8    >   ASSIGN                                                   !1, ~7
   18     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   17    13      > JMP                                                      ->7
         14    >   FE_FREE                                                  $6
   19    15      > RETURN                                                   1

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

End of function __construct

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G0fZj
function name:  key
number of ops:  7
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                  'key'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   13     3        INIT_ARRAY                                       ~3      !0, 'key'
          4        CAST                                          8  ~4      ~3
          5      > RETURN                                                   ~4
   14     6*     > RETURN                                                   null

End of function key

End of class ObjectKeyIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.66 ms | 1388 KiB | 15 Q