3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = []; $ar['one'][] = 1; $ar['one'][] = 2; $ar['two'][] = 1; $ar['two'][] = 2; $ar['three'][] = 1; $ar['three'][] = 2; print_r($ar); $res = []; foreach($ar as $key=>$val){ $res[$key] = $val[0]; } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/JlXJk
function name:  (null)
number of ops:  35
compiled vars:  !0 = $ar, !1 = $res, !2 = $val, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        FETCH_DIM_W                                      $5      !0, 'one'
          2        ASSIGN_DIM                                               $5
          3        OP_DATA                                                  1
    5     4        FETCH_DIM_W                                      $7      !0, 'one'
          5        ASSIGN_DIM                                               $7
          6        OP_DATA                                                  2
    6     7        FETCH_DIM_W                                      $9      !0, 'two'
          8        ASSIGN_DIM                                               $9
          9        OP_DATA                                                  1
    7    10        FETCH_DIM_W                                      $11     !0, 'two'
         11        ASSIGN_DIM                                               $11
         12        OP_DATA                                                  2
    8    13        FETCH_DIM_W                                      $13     !0, 'three'
         14        ASSIGN_DIM                                               $13
         15        OP_DATA                                                  1
    9    16        FETCH_DIM_W                                      $15     !0, 'three'
         17        ASSIGN_DIM                                               $15
         18        OP_DATA                                                  2
   11    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   13    22        ASSIGN                                                   !1, <array>
   14    23      > FE_RESET_R                                       $19     !0, ->30
         24    > > FE_FETCH_R                                       ~20     $19, !2, ->30
         25    >   ASSIGN                                                   !3, ~20
   15    26        FETCH_DIM_R                                      ~23     !2, 0
         27        ASSIGN_DIM                                               !1, !3
         28        OP_DATA                                                  ~23
   14    29      > JMP                                                      ->24
         30    >   FE_FREE                                                  $19
   18    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !1
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.92 ms | 1011 KiB | 14 Q