3v4l.org

run code in 300+ PHP versions simultaneously
<?php $oldarray = [0=>'a',8=>'b',2=>'c',7=>'d',9=>'e',11=>'f']; $newarray = array(); $length = count($oldarray); for($i = 0; $i < $length ; ++$i) { $newarray[] = array('current'=>current($oldarray),'next'=>next($oldarray)); } print_r($newarray);
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 = 19, Position 2 = 6
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 6
Branch analysis from position: 19
Branch analysis from position: 6
filename:       /in/Es4RQ
function name:  (null)
number of ops:  23
compiled vars:  !0 = $oldarray, !1 = $newarray, !2 = $length, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    4     2        COUNT                                            ~6      !0
          3        ASSIGN                                                   !2, ~6
    5     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->17
    7     6    >   INIT_FCALL                                               'current'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $10     
          9        INIT_ARRAY                                       ~11     $10, 'current'
         10        INIT_FCALL                                               'next'
         11        SEND_REF                                                 !0
         12        DO_ICALL                                         $12     
         13        ADD_ARRAY_ELEMENT                                ~11     $12, 'next'
         14        ASSIGN_DIM                                               !1
         15        OP_DATA                                                  ~11
    5    16        PRE_INC                                                  !3
         17    >   IS_SMALLER                                               !3, !2
         18      > JMPNZ                                                    ~14, ->6
    9    19    >   INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.08 ms | 1012 KiB | 16 Q