3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayAsKeyIterator extends IteratorIterator { public function key() { return array('1', parent::key()); } } $it = new ArrayAsKeyIterator(new ArrayIterator(range(0, 1))); iterator_count($it); $it->rewind(); $it->key(); var_dump($it->current(), $it->key()); $array = iterator_to_array($it, FALSE); // because it is wrapped into an iterator iterator, see: $itit = new IteratorIterator($it); $array = iterator_to_array($itit, FALSE);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7mIvr
function name:  (null)
number of ops:  41
compiled vars:  !0 = $it, !1 = $array, !2 = $itit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $3      'ArrayAsKeyIterator'
          1        NEW                                              $4      'ArrayIterator'
          2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $5      
          6        SEND_VAR_NO_REF_EX                                       $5
          7        DO_FCALL                                      0          
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $3
   10    11        INIT_FCALL                                               'iterator_count'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   12    14        INIT_METHOD_CALL                                         !0, 'rewind'
         15        DO_FCALL                                      0          
   13    16        INIT_METHOD_CALL                                         !0, 'key'
         17        DO_FCALL                                      0          
   14    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !0, 'current'
         20        DO_FCALL                                      0  $12     
         21        SEND_VAR                                                 $12
         22        INIT_METHOD_CALL                                         !0, 'key'
         23        DO_FCALL                                      0  $13     
         24        SEND_VAR                                                 $13
         25        DO_ICALL                                                 
   16    26        INIT_FCALL                                               'iterator_to_array'
         27        SEND_VAR                                                 !0
         28        SEND_VAL                                                 <false>
         29        DO_ICALL                                         $15     
         30        ASSIGN                                                   !1, $15
   19    31        NEW                                              $17     'IteratorIterator'
         32        SEND_VAR_EX                                              !0
         33        DO_FCALL                                      0          
         34        ASSIGN                                                   !2, $17
   20    35        INIT_FCALL                                               'iterator_to_array'
         36        SEND_VAR                                                 !2
         37        SEND_VAL                                                 <false>
         38        DO_ICALL                                         $20     
         39        ASSIGN                                                   !1, $20
         40      > RETURN                                                   1

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

End of function key

End of class ArrayAsKeyIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.65 ms | 1400 KiB | 21 Q