3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.45 ms | 1395 KiB | 13 Q