3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Because lol: https://github.com/alvaropinot/circular-iterator class CircularIterator extends IteratorIterator { public function next() { parent::next(); if (!$this->valid()) { $this->rewind(); } } } $iter = new CircularIterator( SplFixedArray::fromArray([1, 2, 3]) ); $iter->rewind(); var_dump($iter->current()); $iter->next(); var_dump($iter->current()); $iter->next(); var_dump($iter->current()); $iter->next(); var_dump($iter->current()); $iter->next();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6qU4C
function name:  (null)
number of ops:  38
compiled vars:  !0 = $iter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'CircularIterator'
   17     1        INIT_STATIC_METHOD_CALL                                  'SplFixedArray', 'fromArray'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $2      
          4        SEND_VAR_NO_REF_EX                                       $2
   16     5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   20     7        INIT_METHOD_CALL                                         !0, 'rewind'
          8        DO_FCALL                                      0          
   22     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'current'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14        INIT_METHOD_CALL                                         !0, 'next'
         15        DO_FCALL                                      0          
   23    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'current'
         18        DO_FCALL                                      0  $9      
         19        SEND_VAR                                                 $9
         20        DO_ICALL                                                 
         21        INIT_METHOD_CALL                                         !0, 'next'
         22        DO_FCALL                                      0          
   24    23        INIT_FCALL                                               'var_dump'
         24        INIT_METHOD_CALL                                         !0, 'current'
         25        DO_FCALL                                      0  $12     
         26        SEND_VAR                                                 $12
         27        DO_ICALL                                                 
         28        INIT_METHOD_CALL                                         !0, 'next'
         29        DO_FCALL                                      0          
   25    30        INIT_FCALL                                               'var_dump'
         31        INIT_METHOD_CALL                                         !0, 'current'
         32        DO_FCALL                                      0  $15     
         33        SEND_VAR                                                 $15
         34        DO_ICALL                                                 
         35        INIT_METHOD_CALL                                         !0, 'next'
         36        DO_FCALL                                      0          
         37      > RETURN                                                   1

Class CircularIterator:
Function next:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/6qU4C
function name:  next
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_STATIC_METHOD_CALL                                  'next'
          1        DO_FCALL                                      0          
   10     2        INIT_METHOD_CALL                                         'valid'
          3        DO_FCALL                                      0  $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPZ                                                     ~2, ->8
   11     6    >   INIT_METHOD_CALL                                         'rewind'
          7        DO_FCALL                                      0          
   13     8    > > RETURN                                                   null

End of function next

End of class CircularIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.54 ms | 1015 KiB | 14 Q