3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = new ArrayObject(array(1, 2)); $it = $array->getIterator(); $array[] = 3; $prev = $array->getIterator(); while ($it->valid()) { echo $prev->current(); echo $it->current(); $prev = clone $it; $it->next(); } $it = $prev; $it->next(); echo $it->valid() ? $it->current() : "not valid";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
Branch analysis from position: 13
filename:       /in/uiird
function name:  (null)
number of ops:  39
compiled vars:  !0 = $array, !1 = $it, !2 = $prev
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'ArrayObject'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    5     4        INIT_METHOD_CALL                                         !0, 'getIterator'
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                                   !1, $6
    7     7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  3
    9     9        INIT_METHOD_CALL                                         !0, 'getIterator'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !2, $9
   11    12      > JMP                                                      ->23
   13    13    >   INIT_METHOD_CALL                                         !2, 'current'
         14        DO_FCALL                                      0  $11     
         15        ECHO                                                     $11
   14    16        INIT_METHOD_CALL                                         !1, 'current'
         17        DO_FCALL                                      0  $12     
         18        ECHO                                                     $12
   15    19        CLONE                                            ~13     !1
         20        ASSIGN                                                   !2, ~13
   16    21        INIT_METHOD_CALL                                         !1, 'next'
         22        DO_FCALL                                      0          
   11    23    >   INIT_METHOD_CALL                                         !1, 'valid'
         24        DO_FCALL                                      0  $16     
         25      > JMPNZ                                                    $16, ->13
   19    26    >   ASSIGN                                                   !1, !2
   20    27        INIT_METHOD_CALL                                         !1, 'next'
         28        DO_FCALL                                      0          
   21    29        INIT_METHOD_CALL                                         !1, 'valid'
         30        DO_FCALL                                      0  $19     
         31      > JMPZ                                                     $19, ->36
         32    >   INIT_METHOD_CALL                                         !1, 'current'
         33        DO_FCALL                                      0  $20     
         34        QM_ASSIGN                                        ~21     $20
         35      > JMP                                                      ->37
         36    >   QM_ASSIGN                                        ~21     'not+valid'
         37    >   ECHO                                                     ~21
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.88 ms | 1399 KiB | 13 Q