3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( array ( 'dnu' => 121428, 'd1' => 43, 'd3' => 27, 'd7' => 20, 'd15' => 15, 'd30' => 12 ) ); print_r($array); $result = []; foreach($array[0] as $key=>$value){ $result[] = ['col'=>$key,'value'=>$value]; } echo json_encode($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/vfG9k
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $result, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    4     4        ASSIGN                                                   !1, <array>
    5     5        FETCH_DIM_R                                      ~7      !0, 0
          6      > FE_RESET_R                                       $8      ~7, ->14
          7    > > FE_FETCH_R                                       ~9      $8, !2, ->14
          8    >   ASSIGN                                                   !3, ~9
    6     9        INIT_ARRAY                                       ~12     !3, 'col'
         10        ADD_ARRAY_ELEMENT                                ~12     !2, 'value'
         11        ASSIGN_DIM                                               !1
         12        OP_DATA                                                  ~12
    5    13      > JMP                                                      ->7
         14    >   FE_FREE                                                  $8
   10    15        INIT_FCALL                                               'json_encode'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $13     
         18        ECHO                                                     $13
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.18 ms | 1014 KiB | 15 Q