3v4l.org

run code in 300+ PHP versions simultaneously
<?php // simulate the array $arr = [0=>'a',8=>'b',2=>'c',7=>'d',9=>'e',11=>'f']; // iterate it without messing with its internal pointer for($i=0;$i<count($arr);$i++) $arr[key($arr)] = ["current" => current($arr), "next" => next($arr)]; // test it print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 3
Branch analysis from position: 20
Branch analysis from position: 3
filename:       /in/UNYK5
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->17
    7     3    >   INIT_FCALL                                               'key'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        INIT_FCALL                                               'current'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        INIT_ARRAY                                       ~7      $6, 'current'
         10        INIT_FCALL                                               'next'
         11        SEND_REF                                                 !0
         12        DO_ICALL                                         $8      
         13        ADD_ARRAY_ELEMENT                                ~7      $8, 'next'
         14        ASSIGN_DIM                                               !0, $4
         15        OP_DATA                                                  ~7
    6    16        PRE_INC                                                  !1
         17    >   COUNT                                            ~10     !0
         18        IS_SMALLER                                               !1, ~10
         19      > JMPNZ                                                    ~11, ->3
   10    20    >   INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.49 ms | 1014 KiB | 17 Q